Tracker: Style fixes
* Style fixes to QueryContainerWindow.h * Style fixes to ContainerWindow * Style fixes to Model * Style fixes to Tracker * Style fixes to PoseView - Most of the changes come from unindenting the code
This commit is contained in:
parent
f19ef17518
commit
7ef62fb6c2
@ -203,7 +203,7 @@ AddOneAddon(const Model* model, const char* name, uint32 shortcut,
|
||||
|
||||
|
||||
static int32
|
||||
AddOnThread(BMessage* refsMessage, entry_ref addonRef, entry_ref dirRef)
|
||||
AddOnThread(BMessage* refsMessage, entry_ref addonRef, entry_ref directoryRef)
|
||||
{
|
||||
std::auto_ptr<BMessage> refsMessagePtr(refsMessage);
|
||||
|
||||
@ -222,7 +222,7 @@ AddOnThread(BMessage* refsMessage, entry_ref addonRef, entry_ref dirRef)
|
||||
|
||||
if (result >= 0) {
|
||||
// call add-on code
|
||||
(*processRefs)(dirRef, refsMessagePtr.get(), 0);
|
||||
(*processRefs)(directoryRef, refsMessagePtr.get(), NULL);
|
||||
|
||||
unload_add_on(addonImage);
|
||||
return B_OK;
|
||||
@ -1664,7 +1664,7 @@ BContainerWindow::MessageReceived(BMessage* message)
|
||||
// there is fMenuBar
|
||||
if (fMenuBar && fFileMenu) {
|
||||
item = fFileMenu->FindItem(kMoveToTrash);
|
||||
if (item) {
|
||||
if (item != NULL) {
|
||||
item->SetLabel(dontMoveToTrash
|
||||
? B_TRANSLATE("Delete")
|
||||
: B_TRANSLATE("Move to Trash"));
|
||||
@ -3213,12 +3213,11 @@ BContainerWindow::LoadAddOn(BMessage* message)
|
||||
|
||||
// add selected refs to message
|
||||
BMessage* refs = new BMessage(B_REFS_RECEIVED);
|
||||
|
||||
BObjectList<BPose>* list = PoseView()->SelectionList();
|
||||
BObjectList<BPose>* selectionList = PoseView()->SelectionList();
|
||||
|
||||
int32 index = 0;
|
||||
BPose* pose;
|
||||
while ((pose = list->ItemAt(index++)) != NULL)
|
||||
while ((pose = selectionList->ItemAt(index++)) != NULL)
|
||||
refs->AddRef("refs", pose->TargetModel()->EntryRef());
|
||||
|
||||
refs->AddMessenger("TrackerViewToken", BMessenger(PoseView()));
|
||||
|
@ -118,33 +118,33 @@ Model::Model()
|
||||
}
|
||||
|
||||
|
||||
Model::Model(const Model &cloneThis)
|
||||
Model::Model(const Model& other)
|
||||
:
|
||||
fEntryRef(cloneThis.fEntryRef),
|
||||
fMimeType(cloneThis.fMimeType),
|
||||
fEntryRef(other.fEntryRef),
|
||||
fMimeType(other.fMimeType),
|
||||
fPreferredAppName(NULL),
|
||||
fBaseType(cloneThis.fBaseType),
|
||||
fIconFrom(cloneThis.fIconFrom),
|
||||
fBaseType(other.fBaseType),
|
||||
fIconFrom(other.fIconFrom),
|
||||
fWritable(false),
|
||||
fNode(NULL),
|
||||
fLocalizedName(cloneThis.fLocalizedName),
|
||||
fHasLocalizedName(cloneThis.fHasLocalizedName),
|
||||
fLocalizedNameIsCached(cloneThis.fLocalizedNameIsCached)
|
||||
fLocalizedName(other.fLocalizedName),
|
||||
fHasLocalizedName(other.fHasLocalizedName),
|
||||
fLocalizedNameIsCached(other.fLocalizedNameIsCached)
|
||||
{
|
||||
fStatBuf.st_dev = cloneThis.NodeRef()->device;
|
||||
fStatBuf.st_ino = cloneThis.NodeRef()->node;
|
||||
fStatBuf.st_dev = other.NodeRef()->device;
|
||||
fStatBuf.st_ino = other.NodeRef()->node;
|
||||
|
||||
if (cloneThis.IsSymLink() && cloneThis.LinkTo())
|
||||
fLinkTo = new Model(*cloneThis.LinkTo());
|
||||
if (other.IsSymLink() && other.LinkTo())
|
||||
fLinkTo = new Model(*other.LinkTo());
|
||||
|
||||
fStatus = OpenNode(cloneThis.IsNodeOpenForWriting());
|
||||
fStatus = OpenNode(other.IsNodeOpenForWriting());
|
||||
if (fStatus == B_OK) {
|
||||
ASSERT(fNode);
|
||||
fNode->GetStat(&fStatBuf);
|
||||
ASSERT(fStatBuf.st_dev == cloneThis.NodeRef()->device);
|
||||
ASSERT(fStatBuf.st_ino == cloneThis.NodeRef()->node);
|
||||
ASSERT(fStatBuf.st_dev == other.NodeRef()->device);
|
||||
ASSERT(fStatBuf.st_ino == other.NodeRef()->node);
|
||||
}
|
||||
if (!cloneThis.IsNodeOpen())
|
||||
if (!other.IsNodeOpen())
|
||||
CloseNode();
|
||||
}
|
||||
|
||||
@ -866,7 +866,7 @@ void
|
||||
Model::UpdateEntryRef(const node_ref* dirNode, const char* name)
|
||||
{
|
||||
if (IsVolume()) {
|
||||
if (fVolumeName)
|
||||
if (fVolumeName != NULL)
|
||||
DeletePreferredAppVolumeNameLinkTo();
|
||||
|
||||
fVolumeName = strdup(name);
|
||||
@ -875,7 +875,7 @@ Model::UpdateEntryRef(const node_ref* dirNode, const char* name)
|
||||
fEntryRef.device = dirNode->device;
|
||||
fEntryRef.directory = dirNode->node;
|
||||
|
||||
if (fEntryRef.name && strcmp(fEntryRef.name, name) == 0)
|
||||
if (fEntryRef.name != NULL && strcmp(fEntryRef.name, name) == 0)
|
||||
return;
|
||||
|
||||
fEntryRef.set_name(name);
|
||||
@ -887,7 +887,7 @@ Model::WatchVolumeAndMountPoint(uint32 , BHandler* target)
|
||||
{
|
||||
ASSERT(IsVolume());
|
||||
|
||||
if (fEntryRef.name && fVolumeName
|
||||
if (fEntryRef.name != NULL && fVolumeName != NULL
|
||||
&& strcmp(fEntryRef.name, "boot") == 0) {
|
||||
// watch mount point for boot volume
|
||||
BString bootMountPoint("/");
|
||||
|
@ -78,7 +78,7 @@ enum {
|
||||
class Model {
|
||||
public:
|
||||
Model();
|
||||
Model(const Model &);
|
||||
Model(const Model& other);
|
||||
Model(const BEntry* entry, bool open = false, bool writable = false);
|
||||
Model(const entry_ref*, bool traverse = false, bool open = false,
|
||||
bool writable = false);
|
||||
|
@ -8566,8 +8566,7 @@ BPoseView::ClearSelection()
|
||||
fSelectionPivotPose = NULL;
|
||||
fRealPivotPose = NULL;
|
||||
|
||||
if (fSelectionList->CountItems()) {
|
||||
|
||||
if (fSelectionList->CountItems() > 0) {
|
||||
// scan all visible poses first
|
||||
BRect bounds(Bounds());
|
||||
|
||||
@ -8613,6 +8612,7 @@ BPoseView::ClearSelection()
|
||||
|
||||
fSelectionList->MakeEmpty();
|
||||
}
|
||||
|
||||
fMimeTypesInSelectionCache.MakeEmpty();
|
||||
}
|
||||
|
||||
@ -8625,72 +8625,73 @@ BPoseView::ShowSelection(bool show)
|
||||
|
||||
fSelectionVisible = show;
|
||||
|
||||
if (fSelectionList->CountItems()) {
|
||||
if (fSelectionList->CountItems() <= 0)
|
||||
return;
|
||||
|
||||
// scan all visible poses first
|
||||
BRect bounds(Bounds());
|
||||
// scan all visible poses first
|
||||
BRect bounds(Bounds());
|
||||
|
||||
if (ViewMode() == kListMode) {
|
||||
int32 startIndex = (int32)(bounds.top / fListElemHeight);
|
||||
BPoint loc(0, startIndex * fListElemHeight);
|
||||
if (ViewMode() == kListMode) {
|
||||
int32 startIndex = (int32)(bounds.top / fListElemHeight);
|
||||
BPoint loc(0, startIndex * fListElemHeight);
|
||||
|
||||
PoseList* poseList = CurrentPoseList();
|
||||
int32 count = poseList->CountItems();
|
||||
for (int32 index = startIndex; index < count; index++) {
|
||||
BPose* pose = poseList->ItemAt(index);
|
||||
PoseList* poseList = CurrentPoseList();
|
||||
int32 count = poseList->CountItems();
|
||||
for (int32 index = startIndex; index < count; index++) {
|
||||
BPose* pose = poseList->ItemAt(index);
|
||||
if (fSelectionList->HasItem(pose))
|
||||
if (pose->IsSelected() != show
|
||||
|| fShowSelectionWhenInactive) {
|
||||
if (!fShowSelectionWhenInactive)
|
||||
pose->Select(show);
|
||||
|
||||
pose->Draw(BRect(pose->CalcRect(loc, this, false)),
|
||||
bounds, this, false);
|
||||
}
|
||||
|
||||
loc.y += fListElemHeight;
|
||||
if (loc.y > bounds.bottom)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
int32 startIndex = FirstIndexAtOrBelow(
|
||||
(int32)(bounds.top - IconPoseHeight()), true);
|
||||
int32 count = fVSPoseList->CountItems();
|
||||
for (int32 index = startIndex; index < count; index++) {
|
||||
BPose* pose = fVSPoseList->ItemAt(index);
|
||||
if (pose != NULL) {
|
||||
if (fSelectionList->HasItem(pose))
|
||||
if (pose->IsSelected() != show
|
||||
|| fShowSelectionWhenInactive) {
|
||||
if (!fShowSelectionWhenInactive)
|
||||
pose->Select(show);
|
||||
|
||||
pose->Draw(BRect(pose->CalcRect(loc, this, false)),
|
||||
bounds, this, false);
|
||||
Invalidate(pose->CalcRect(this));
|
||||
}
|
||||
|
||||
loc.y += fListElemHeight;
|
||||
if (loc.y > bounds.bottom)
|
||||
if (pose->Location(this).y > bounds.bottom)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
int32 startIndex = FirstIndexAtOrBelow(
|
||||
(int32)(bounds.top - IconPoseHeight()), true);
|
||||
int32 count = fVSPoseList->CountItems();
|
||||
for (int32 index = startIndex; index < count; index++) {
|
||||
BPose* pose = fVSPoseList->ItemAt(index);
|
||||
if (pose != NULL) {
|
||||
if (fSelectionList->HasItem(pose))
|
||||
if (pose->IsSelected() != show
|
||||
|| fShowSelectionWhenInactive) {
|
||||
if (!fShowSelectionWhenInactive)
|
||||
pose->Select(show);
|
||||
|
||||
Invalidate(pose->CalcRect(this));
|
||||
}
|
||||
|
||||
if (pose->Location(this).y > bounds.bottom)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now set all other poses
|
||||
int32 count = fSelectionList->CountItems();
|
||||
for (int32 index = 0; index < count; index++) {
|
||||
BPose* pose = fSelectionList->ItemAt(index);
|
||||
if (pose->IsSelected() != show && !fShowSelectionWhenInactive)
|
||||
pose->Select(show);
|
||||
}
|
||||
// now set all other poses
|
||||
int32 count = fSelectionList->CountItems();
|
||||
for (int32 index = 0; index < count; index++) {
|
||||
BPose* pose = fSelectionList->ItemAt(index);
|
||||
if (pose->IsSelected() != show && !fShowSelectionWhenInactive)
|
||||
pose->Select(show);
|
||||
}
|
||||
|
||||
// finally update fRealPivotPose/fSelectionPivotPose
|
||||
if (!show) {
|
||||
fRealPivotPose = fSelectionPivotPose;
|
||||
fSelectionPivotPose = NULL;
|
||||
} else {
|
||||
if (fRealPivotPose)
|
||||
fSelectionPivotPose = fRealPivotPose;
|
||||
fRealPivotPose = NULL;
|
||||
}
|
||||
// finally update fRealPivotPose/fSelectionPivotPose
|
||||
if (!show) {
|
||||
fRealPivotPose = fSelectionPivotPose;
|
||||
fSelectionPivotPose = NULL;
|
||||
} else {
|
||||
if (fRealPivotPose)
|
||||
fSelectionPivotPose = fRealPivotPose;
|
||||
|
||||
fRealPivotPose = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,22 +50,23 @@ class BQueryPoseView;
|
||||
|
||||
class BQueryContainerWindow : public BContainerWindow {
|
||||
public:
|
||||
BQueryContainerWindow(LockingList<BWindow>* windowList,
|
||||
uint32 containerWindowFlags);
|
||||
BQueryContainerWindow(
|
||||
LockingList<BWindow>* windowList,
|
||||
uint32 containerWindowFlags);
|
||||
|
||||
BQueryPoseView* PoseView() const;
|
||||
bool ActiveOnDevice(dev_t) const;
|
||||
BQueryPoseView* PoseView() const;
|
||||
bool ActiveOnDevice(dev_t) const;
|
||||
|
||||
protected:
|
||||
virtual void CreatePoseView(Model*);
|
||||
virtual BPoseView* NewPoseView(Model* model, uint32 viewMode);
|
||||
virtual void AddWindowMenu(BMenu* menu);
|
||||
virtual void AddWindowContextMenus(BMenu* menu);
|
||||
virtual void CreatePoseView(Model*);
|
||||
virtual BPoseView* NewPoseView(Model* model, uint32 viewMode);
|
||||
virtual void AddWindowMenu(BMenu* menu);
|
||||
virtual void AddWindowContextMenus(BMenu* menu);
|
||||
|
||||
virtual void SetUpDefaultState();
|
||||
virtual void SetUpDefaultState();
|
||||
|
||||
private:
|
||||
typedef BContainerWindow _inherited;
|
||||
typedef BContainerWindow _inherited;
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
@ -67,6 +67,7 @@ All rights reserved.
|
||||
#include "ContainerWindow.h"
|
||||
#include "DeskWindow.h"
|
||||
#include "FindPanel.h"
|
||||
#include "FunctionObject.h"
|
||||
#include "FSClipboard.h"
|
||||
#include "FSUtils.h"
|
||||
#include "InfoWindow.h"
|
||||
@ -77,12 +78,11 @@ All rights reserved.
|
||||
#include "PoseView.h"
|
||||
#include "QueryContainerWindow.h"
|
||||
#include "StatusWindow.h"
|
||||
#include "TrashWatcher.h"
|
||||
#include "FunctionObject.h"
|
||||
#include "TrackerSettings.h"
|
||||
#include "TrackerSettingsWindow.h"
|
||||
#include "TaskLoop.h"
|
||||
#include "Thread.h"
|
||||
#include "TrackerSettings.h"
|
||||
#include "TrackerSettingsWindow.h"
|
||||
#include "TrashWatcher.h"
|
||||
#include "VirtualDirectoryWindow.h"
|
||||
|
||||
|
||||
@ -631,7 +631,7 @@ TTracker::Pulse()
|
||||
void
|
||||
TTracker::SetDefaultPrinter(const BMessage* message)
|
||||
{
|
||||
// get the first item selected
|
||||
// get the first item selected
|
||||
int32 count = 0;
|
||||
uint32 type = 0;
|
||||
message->GetInfo("refs", &type, &count);
|
||||
@ -677,7 +677,6 @@ TTracker::MoveRefsToTrash(const BMessage* message)
|
||||
BObjectList<entry_ref>* srcList = new BObjectList<entry_ref>(count, true);
|
||||
|
||||
for (int32 index = 0; index < count; index++) {
|
||||
|
||||
entry_ref ref;
|
||||
ASSERT(message->FindRef("refs", index, &ref) == B_OK);
|
||||
if (message->FindRef("refs", index, &ref) != B_OK)
|
||||
@ -685,13 +684,14 @@ TTracker::MoveRefsToTrash(const BMessage* message)
|
||||
|
||||
AutoLock<WindowList> lock(&fWindowList);
|
||||
BContainerWindow* window = FindParentContainerWindow(&ref);
|
||||
if (window)
|
||||
if (window != NULL) {
|
||||
// if we have a window open for this entry, ask the pose to
|
||||
// delete it, this will select the next entry
|
||||
window->PoseView()->MoveEntryToTrash(&ref);
|
||||
else
|
||||
} else {
|
||||
// add all others to a list that gets deleted separately
|
||||
srcList->AddItem(new entry_ref(ref));
|
||||
}
|
||||
}
|
||||
|
||||
// async move to trash
|
||||
@ -817,7 +817,7 @@ TTracker::OpenRef(const entry_ref* ref, const node_ref* nodeToClose,
|
||||
|
||||
if (openAsContainer || selector == kRunOpenWithWindow) {
|
||||
// special case opening plain folders, queries or using open with
|
||||
OpenContainerWindow(model, 0, selector, kRestoreDecor);
|
||||
OpenContainerWindow(model, NULL, selector, kRestoreDecor);
|
||||
// window adopts model
|
||||
if (nodeToClose)
|
||||
CloseParentWaitingForChildSoon(ref, nodeToClose);
|
||||
@ -878,7 +878,7 @@ TTracker::RefsReceived(BMessage* message)
|
||||
|
||||
switch (selector) {
|
||||
case kRunOpenWithWindow:
|
||||
OpenContainerWindow(0, message, selector);
|
||||
OpenContainerWindow(NULL, message, selector);
|
||||
// window adopts model
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user