#ifndef _TRACKER_H
#define _TRACKER_H
#include <Application.h>
#include <Resources.h>
#include <Entry.h>
#include "LockingList.h"
#include "SettingsHandler.h"
#include "Utilities.h"
#include "tracker_private.h"
namespace BPrivate {
class BClipboardRefsWatcher;
class BContainerWindow;
class BDeskWindow;
class BInfoWindow;
class BTrashWatcher;
class ExtraAttributeLazyInstaller;
class MimeTypeList;
class Model;
class BooleanValueSetting;
class ScalarValueSetting;
class HexScalarValueSetting;
class TaskLoop;
class TrackerSettingsWindow;
typedef LockingList<BWindow> WindowList;
const uint32 kNextSpecifier = 'snxt';
const uint32 kPreviousSpecifier = 'sprv';
const uint32 B_ENTRY_SPECIFIER = 'sref';
#define kPropertyEntry "Entry"
#define kPropertySelection "Selection"
class TTracker : public BApplication {
public:
TTracker();
virtual ~TTracker();
virtual void Quit();
virtual bool QuitRequested();
virtual void ReadyToRun();
virtual void MessageReceived(BMessage* message);
virtual void Pulse();
virtual void RefsReceived(BMessage* message);
virtual void ArgvReceived(int32 argc, char** argv);
MimeTypeList* MimeTypes() const;
bool TrashFull() const;
bool IsTrashNode(const node_ref* node) const;
bool InTrashNode(const entry_ref* ref) const;
void CloseParentWaitingForChildSoon(const entry_ref* child,
const node_ref* parent);
void SelectChildInParentSoon(const entry_ref* parent,
const node_ref* child);
void SelectPoseAtLocationSoon(node_ref parent, BPoint location);
enum OpenSelector {
kOpen,
kOpenWith,
kRunOpenWithWindow
};
bool EntryHasWindowOpen(const entry_ref*);
status_t NeedMoreNodeMonitors();
static status_t WatchNode(const node_ref*, uint32 flags,
BMessenger target);
TaskLoop* MainTaskLoop() const;
BMessenger MountServer() const;
bool QueryActiveForDevice(dev_t);
void CloseActiveQueryWindows(dev_t);
void SaveAllPoseLocations();
void CloseParent(node_ref closeThis);
void ShowSettingsWindow();
void PostMessageToAllContainerWindows(BMessage& message) const;
BContainerWindow* FindContainerWindow(const node_ref*,
int32 number = 0) const;
BContainerWindow* FindContainerWindow(const entry_ref*,
int32 number = 0) const;
BContainerWindow* FindParentContainerWindow(const entry_ref*) const;
BClipboardRefsWatcher* ClipboardRefsWatcher() const;
protected:
virtual BHandler* ResolveSpecifier(BMessage*, int32, BMessage*,
int32, const char*);
virtual status_t GetSupportedSuites(BMessage*);
bool HandleScriptingMessage(BMessage*);
bool ExecuteProperty(BMessage*, int32, const char*, BMessage*);
bool CreateProperty(BMessage*, BMessage*, int32, const char*,
BMessage*);
bool DeleteProperty(BMessage*, int32,
const char*, BMessage*);
bool CountProperty(BMessage*, int32, const char*, BMessage*);
bool GetProperty(BMessage*, int32, const char*, BMessage*);
bool SetProperty(BMessage*, BMessage*, int32, const char*, BMessage*);
private:
class WatchingInterface;
private:
bool CloseParentWaitingForChild(const entry_ref* child,
const node_ref* parent);
bool LaunchAndCloseParentIfOK(const entry_ref* launchThis,
const node_ref* closeThis, const BMessage* messageToBundle);
bool SelectChildInParent(const entry_ref* parent,
const node_ref* child);
void SelectPoseAtLocationInParent(node_ref parent, BPoint location);
bool CloseParentWindowCommon(BContainerWindow*);
void InitMimeTypes();
bool InstallMimeIfNeeded(const char* type, int32 bitsID,
const char* shortDescription, const char* longDescription,
const char* preferredAppSignature, uint32 forceMask = 0);
void InstallDefaultTemplates();
void InstallTemporaryBackgroundImages();
void InstallIndices();
void InstallIndices(dev_t);
void CloseAllWindows();
void CloseWindowAndChildren(const node_ref*);
void CloseAllInWorkspace();
void OpenInfoWindows(BMessage*);
void MoveRefsToTrash(const BMessage*);
void SelectRefs(const BMessage*);
void OpenContainerWindow(Model*, BMessage* refsList = NULL,
OpenSelector openSelector = kOpen, uint32 openFlags = 0,
bool checkAlreadyOpen = true,
const BMessage* stateMessage = NULL);
void _OpenPreviouslyOpenedWindows(const char* pathFilter = NULL);
void SetDefaultPrinter(const BMessage*);
void EditQueries(const BMessage*);
BInfoWindow* FindInfoWindow(const node_ref*) const;
BDeskWindow* GetDeskWindow() const;
status_t OpenRef(const entry_ref*, const node_ref* nodeToClose = NULL,
const node_ref* nodeToSelect = NULL,
OpenSelector selector = kOpen,
const BMessage* messageToBundle = NULL);
MimeTypeList* fMimeTypeList;
WindowList fWindowList;
BClipboardRefsWatcher* fClipboardRefsWatcher;
BTrashWatcher* fTrashWatcher;
TaskLoop* fTaskLoop;
int32 fNodeMonitorCount;
WatchingInterface* fWatchingInterface;
TrackerSettingsWindow* fSettingsWindow;
typedef BApplication _inherited;
};
inline TaskLoop*
TTracker::MainTaskLoop() const
{
return fTaskLoop;
}
inline BClipboardRefsWatcher*
TTracker::ClipboardRefsWatcher() const
{
return fClipboardRefsWatcher;
}
}
using namespace BPrivate;
#endif