Exemple #1
0
OP_STATUS GroupsModel::SubscribeFolder(UINT32 id, BOOL subscribe)
{
	GroupsModelItem* item = GetItemByID(id);

	if (item)
	{
		item->SetIsSubscribed(subscribe);
		item->Change();

	}
	return OpStatus::OK;
}
Exemple #2
0
char *CFileTable::GetPathByHandle(unsigned char *handle)
{
	unsigned int id;
	tree_node_<FILE_ITEM>* node;

	id = *(unsigned int *)handle;
	// TODO : Not found item
	node = GetItemByID(id);
	if (node != NULL) {
		return g_FileTree.GetNodeFullPath(node);
	} else {
		return NULL;
	}
    //return pItem == NULL ? NULL : pItem->path;
}
Exemple #3
0
OP_STATUS GroupsModel::UpdateFolder(UINT32 item_id, const OpStringC& path, const OpStringC& name)
{
	GroupsModelItem* item = GetItemByID(item_id);

	OP_STATUS ret = OpStatus::OK;
	if (item)
	{
		ret = item->SetPath(path);

		if (ret==OpStatus::OK)
			ret=item->SetName(name);

		item->Change();
	}
	return ret;
}
Exemple #4
0
GenericTreeModelItem* GenericTreeModel::GetGenericItemByID(INT32 id)
{
	OpTreeModelItem* item;
	GetItemByID(id, item);
	return item ? (GenericTreeModelItem*) item : NULL;
}
Exemple #5
0
BOOL OpWindowList::OnInputAction(OpInputAction* action)
{
	switch (action->GetAction())
	{
		case OpInputAction::ACTION_GET_ACTION_STATE:
		{
			OpInputAction* child_action = action->GetChildAction();
			OpTreeModelItem* item = GetSelectedItem();
			DesktopWindow* dw = item
					? static_cast<DesktopWindowCollectionItem*>(item)
							->GetDesktopWindow()
					: 0;

			switch(child_action->GetAction())
			{
				case OpInputAction::ACTION_MAXIMIZE_PAGE:
				case OpInputAction::ACTION_MINIMIZE_PAGE:
				case OpInputAction::ACTION_RESTORE_PAGE:
				case OpInputAction::ACTION_ACTIVATE_WINDOW:
				case OpInputAction::ACTION_DETACH_PAGE:
					{
						child_action->SetEnabled( dw && dw->GetType() != WINDOW_TYPE_BROWSER && dw->GetWorkspace() );
					}
					return TRUE;

				case OpInputAction::ACTION_RELOAD:
					{
						child_action->SetEnabled( dw && dw->GetType() == WINDOW_TYPE_DOCUMENT && dw->GetWorkspace() );
					}
					return TRUE;

				case OpInputAction::ACTION_LOCK_PAGE:
				case OpInputAction::ACTION_UNLOCK_PAGE:
					{
						UINT32 items = GetSelectedItemCount();
						if(items > 1)
						{
							child_action->SetSelected(FALSE);
						}
						else
						{
							child_action->SetEnabled( dw && dw->GetType() != WINDOW_TYPE_BROWSER && dw->GetWorkspace() );
							if(child_action->GetAction() == OpInputAction::ACTION_LOCK_PAGE)
							{
								child_action->SetSelected( dw && dw->IsLockedByUser());
							}
							else
							{
								child_action->SetSelected( dw && !dw->IsLockedByUser());
							}
						}
					}
					return TRUE;

				case OpInputAction::ACTION_CLOSE_PAGE:
					{
						UINT32 items = GetSelectedItemCount();
						if(items > 1)
						{
							child_action->SetEnabled(TRUE);
						}
						else
						{
							child_action->SetEnabled( dw && dw->IsClosableByUser());
						}
					}
					return TRUE;

				case OpInputAction::ACTION_DISSOLVE_TAB_GROUP:
				case OpInputAction::ACTION_CLOSE_TAB_GROUP:
					child_action->SetEnabled(item && item->GetType() == WINDOW_TYPE_GROUP);
					return TRUE;
			}
			return FALSE;
		}

		case OpInputAction::ACTION_LOCK_PAGE:
		case OpInputAction::ACTION_UNLOCK_PAGE:
			{
				OpINT32Vector items;
				INT32 idx;
				INT32 count = GetSelectedItems(items, FALSE);

				for(idx = 0; idx < count; idx++)
				{
					INT32 id = items.Get((UINT32)idx);
					OpTreeModelItem* item = GetItemByPosition(id);
					if (item)
					{
						DesktopWindow *window =
								static_cast<DesktopWindowCollectionItem*>(item)
										->GetDesktopWindow();
						if(window != NULL)
						{
							OpPagebar* pagebar = NULL;

							window->SetLockedByUser(window->IsLockedByUser() ? FALSE : TRUE);

							pagebar = (OpPagebar *)window->GetWidgetByType(OpTypedObject::WIDGET_TYPE_PAGEBAR);
							if(pagebar)
							{
								INT32 pos = pagebar->FindWidgetByUserData(window);
								if (pos >= 0)
								{
									OpWidget *button = pagebar->GetWidget(pos);
									if(button && button->IsOfType(WIDGET_TYPE_PAGEBAR_BUTTON))
									{
										pagebar->OnLockedByUser(static_cast<PagebarButton *>(button), window->IsLockedByUser());
									}
									else
									{
										if (button)
											button->Relayout(TRUE, TRUE);
									}
								}
							}
						}
					}
				}
				g_input_manager->UpdateAllInputStates();
			}
			return TRUE;

		// Only the first.
		case OpInputAction::ACTION_ACTIVATE_WINDOW:
		{
			OpTreeModelItem* item = GetSelectedItem();
			if (item)
			{
				DesktopWindow* window =
						static_cast<DesktopWindowCollectionItem*>(item)
								->GetDesktopWindow();
				if (!window)
					break;

				window->Activate();

#if defined(_UNIX_DESKTOP_)
				// We cannot do Raise() in Activate() in unix because focus-follows-mouse
				// focus mode shall activate but not auto raise a window [espen 2006-09-28]
				if( window->GetType() == WINDOW_TYPE_BROWSER )
				{
					window->GetOpWindow()->Raise();
				}
				else if( window->GetParentDesktopWindow() )
				{
					window->GetParentDesktopWindow()->GetOpWindow()->Raise();
					window->GetOpWindow()->Raise();
				}
#endif

			}
			return TRUE;
		}

		case OpInputAction::ACTION_DELETE:
		{
			OpInputAction new_action(OpInputAction::ACTION_CLOSE_PAGE);
			new_action.SetActionData(2);
			return OnInputAction(&new_action);
		}

		case OpInputAction::ACTION_SHOW_CONTEXT_MENU:
		{
			OnContextMenu(GetBounds().Center(), NULL, action->IsKeyboardInvoked());
			return TRUE;
		}
		case OpInputAction::ACTION_CLOSE_PAGE:
		{
			OpINT32Vector items;
			INT32 idx;
			INT32 count = GetSelectedItems(items, FALSE);

			for(idx = 0; idx < count; idx++)
			{
				INT32 id = items.Get((UINT32)idx);
				OpTreeModelItem* item = GetItemByPosition(id);
				if (item)
				{
					if (item->GetType() == WINDOW_TYPE_BROWSER)
					{
						BrowserDesktopWindow *window =
								static_cast<BrowserDesktopWindow*>(
										static_cast<DesktopWindowCollectionItem*>(
												item)->GetDesktopWindow());
						window->Close(FALSE, TRUE, FALSE);
						return TRUE;
					}
					else
					{
						DesktopWindow *window =
								static_cast<DesktopWindowCollectionItem*>(item)
										->GetDesktopWindow();
						if(window != NULL && window->IsClosableByUser())
						{
							window->Close(FALSE, TRUE, FALSE);
						}
					}
				}
			}
		}
		return TRUE;

		case OpInputAction::ACTION_FOCUS_NEXT_WIDGET:
		case OpInputAction::ACTION_FOCUS_PREVIOUS_WIDGET:
			return OpTreeView::OnInputAction(action);

		case OpInputAction::ACTION_DISSOLVE_TAB_GROUP:
		{
			DesktopWindowCollectionItem* item = static_cast<DesktopWindowCollectionItem*>(GetSelectedItem());
			if (item && item->GetType() == WINDOW_TYPE_GROUP)
				item->GetModel()->UnGroup(item);
			return TRUE;
		}
		case OpInputAction::ACTION_CLOSE_TAB_GROUP:
		{
			DesktopWindowCollectionItem* item = static_cast<DesktopWindowCollectionItem*>(GetSelectedItem());
			if (item && item->GetType() == WINDOW_TYPE_GROUP)
				item->GetModel()->DestroyGroup(item);
			return TRUE;
		}

		default:
		{
			// Prevent sending lowlevel events to desktop windows (bug #227626) [espen 2007-02-22]
			if( action->GetAction() < OpInputAction::LAST_ACTION )
			{
				OpINT32Vector items;
				int item_count = GetSelectedItems(items);
				BOOL handled = FALSE;

				for (INT32 i = 0; i < item_count; i++)
				{
					DesktopWindow* window = GetDesktopWindowByPosition(GetItemByID(items.Get(i)));
					if( window && window->OnInputAction(action) )
					{
						handled = TRUE;
					}
				}

				if (handled)
					return TRUE;
			}
		}
	}

	return OpTreeView::OnInputAction(action);
}