コード例 #1
0
void CIPBookmarkObserver::BookmarkItemAdded(void *pData,bool bFolder)
{
	IPBookmarkAddedNotification_t *pipban = reinterpret_cast<IPBookmarkAddedNotification_t *>(pData);

	/* TODO: Find the parent with the specified GUID. */
	//pipban->guidParent
	CBookmarkFolder *pParentBookmarkFolder = m_pAllBookmarks;

	m_pipbns->SetIPBroadcast(false);

	char *pSerializedData = reinterpret_cast<char *>(pData) + sizeof(IPBookmarkAddedNotification_t);

	try
	{
		if(bFolder)
		{
			CBookmarkFolder BookmarkFolder = CBookmarkFolder::Unserialize(pSerializedData);
			pParentBookmarkFolder->InsertBookmarkFolder(BookmarkFolder,pipban->uPosition);
		}
		else
		{
			CBookmark Bookmark(pSerializedData);
			pParentBookmarkFolder->InsertBookmark(Bookmark,pipban->uPosition);
		}
	}
	catch(int)
	{
		/* The actual content of the error here
		is unimportant. May be needed in the
		future if an error message will be shown
		to the user. */
	}

	m_pipbns->SetIPBroadcast(true);
}
コード例 #2
0
void DocSettings::Load(const XMLNode& node)
{
	CString strTagName = MakeCString(node.tagName);
	if (strTagName != pszTagSettings && strTagName != pszTagContent)
		return;

	if (strTagName == pszTagSettings)
	{
		node.GetIntAttribute(pszAttrStartPage, nPage);
		node.GetLongAttribute(pszAttrOffsetX, ptOffset.x);
		node.GetLongAttribute(pszAttrOffsetY, ptOffset.y);
		node.GetIntAttribute(pszAttrZoomType, nZoomType);
		node.GetDoubleAttribute(pszAttrZoom, fZoom);
		node.GetIntAttribute(pszAttrLayout, nLayout);
		node.GetIntAttribute(pszAttrDisplayMode, nDisplayMode);
		node.GetIntAttribute(pszAttrRotate, nRotate);
		node.GetIntAttribute(pszAttrOpenSidebarTab, nOpenSidebarTab);

		int nFirstPage;
		if (node.GetIntAttribute(pszAttrFirstPage, nFirstPage))
			bFirstPageAlone = (nFirstPage != 0);

		int nRightToLeft;
		if (node.GetIntAttribute(pszAttrRightToLeft, nRightToLeft))
			bRightToLeft = (nRightToLeft != 0);
	}

	pageSettings.clear();
	bookmarks.clear();

	list<XMLNode>::const_iterator it;
	for (it = node.childElements.begin(); it != node.childElements.end(); ++it)
	{
		const XMLNode& child = *it;
		if (MakeCString(child.tagName) == pszTagPageSettings)
		{
			int pageNo;
			if (!child.GetIntAttribute(pszAttrNumber, pageNo))
				continue;

			PageSettings& data = pageSettings[pageNo - 1];
			data.Load(child);
		}
		else if (MakeCString(child.tagName) == pszTagBookmarks)
		{
			list<XMLNode>::const_iterator it;
			for (it = child.childElements.begin(); it != child.childElements.end(); ++it)
			{
				const XMLNode& bmNode = *it;
				if (MakeCString(bmNode.tagName) == pszTagBookmark)
				{
					bookmarks.push_back(Bookmark());
					Bookmark& bookmark = bookmarks.back();
					bookmark.Load(bmNode);
				}
			}
		}
	}
}
コード例 #3
0
void BookmarksModel::addItem(BookmarkType type, const QString &text,
			     const QVariant &fields, const QVariant &userData)
{
		int pos = m_bookmarks.size();
		beginInsertRows(QModelIndex(), pos, pos);
	m_bookmarks.append(Bookmark(type, text, fields, userData));
		endInsertRows();
}
コード例 #4
0
ファイル: bookmark.cpp プロジェクト: Orochimarufan/vlyc2
bool BookmarkModel::insertRows(int row, int count, const QModelIndex &parent)
{
    emit beginInsertRows(parent, row, row + count - 1);
    for (int i=count; i; --i)
        m_bookmarks.insert(row, Bookmark());
    emit endInsertRows();
    return true;
}
コード例 #5
0
ファイル: bookmarksmodel.cpp プロジェクト: CyberSys/qutim
void BookmarksModel::addItem(BookmarkType type, const QString &text,
							 const QVariant &fields, const QVariant &userData)
{
	if (!m_resetting) {
		int pos = m_bookmarks.size();
		beginInsertRows(QModelIndex(), pos, pos);
	}
	m_bookmarks.push_back(Bookmark(type, text, fields, userData));
	if (!m_resetting)
		endRemoveRows();
}
コード例 #6
0
TEST(BookmarkTest,BookmarkCreation)
{
	std::wstring Name(L"Test name");
	std::wstring Location(L"Test location");
	std::wstring Description(L"Test description");
	CBookmark Bookmark(Name,Location,Description);

	EXPECT_EQ(Name,Bookmark.GetName());
	EXPECT_EQ(Location,Bookmark.GetLocation());
	EXPECT_EQ(Description,Bookmark.GetDescription());
}
コード例 #7
0
TEST(BookmarkTest,UpdateNotifications)
{
	CBookmarkFolder BookmarkFolderParent = CBookmarkFolder::Create(L"Test");

	CTestBookmarkItemNotifier *ptbn = new CTestBookmarkItemNotifier();
	CBookmarkItemNotifier::GetInstance().AddObserver(ptbn);

	CBookmark Bookmark(L"Test name",L"Test location",L"Test description");
	BookmarkFolderParent.InsertBookmark(Bookmark);

	Bookmark.SetName(L"New test folder name");
}
コード例 #8
0
TEST(BookmarkTest,BookmarkChild)
{
	CBookmarkFolder BookmarkFolderParent = CBookmarkFolder::Create(L"Test");
	CBookmark Bookmark(L"Test name",L"Test location",L"Test description");

	BookmarkFolderParent.InsertBookmark(Bookmark);

	EXPECT_EQ(false,BookmarkFolderParent.HasChildFolder());

	auto itr = BookmarkFolderParent.begin();

	CBookmark ChildBookmark = boost::get<CBookmark>(*itr);

	EXPECT_EQ(Bookmark.GetName(),ChildBookmark.GetName());
	EXPECT_EQ(Bookmark.GetLocation(),ChildBookmark.GetLocation());
	EXPECT_EQ(Bookmark.GetDescription(),ChildBookmark.GetDescription());
}
コード例 #9
0
TEST(BookmarkTest,BookmarkUpdates)
{
	std::wstring Name(L"Test name");
	std::wstring Location(L"Test location");
	std::wstring Description(L"Test description");
	CBookmark Bookmark(Name,Location,Description);

	std::wstring NewName(L"New test name");
	Bookmark.SetName(NewName);
	EXPECT_EQ(NewName,Bookmark.GetName());

	std::wstring NewLocation(L"New test location");
	Bookmark.SetLocation(NewLocation);
	EXPECT_EQ(NewLocation,Bookmark.GetLocation());

	std::wstring NewDescription(L"New test description");
	Bookmark.SetDescription(NewDescription);
	EXPECT_EQ(NewDescription,Bookmark.GetDescription());
}
コード例 #10
0
void Bookmark::Load(const XMLNode& node)
{
	if (MakeCString(node.tagName) != pszTagBookmark)
		return;

	wstring str;
	if (node.GetAttribute(pszAttrTitle, str))
		strTitle = MakeUTF8String(str);

	node.GetIntAttribute(pszAttrType, nLinkType);

	if (nLinkType == URL)
	{
		if (node.GetAttribute(pszAttrURL, str))
			strURL = MakeUTF8String(str);
	}
	else if (nLinkType == Page || nLinkType == View)
	{
		node.GetIntAttribute(pszAttrPage, nPage);
		if (nLinkType == View)
		{
			node.GetLongAttribute(pszAttrOffsetX, ptOffset.x);
			node.GetLongAttribute(pszAttrOffsetY, ptOffset.y);

			int nMargin;
			if (node.GetIntAttribute(pszAttrMargin, nMargin))
				bMargin = (nMargin != 0);
		}
	}

	list<XMLNode>::const_iterator it;
	for (it = node.childElements.begin(); it != node.childElements.end(); ++it)
	{
		const XMLNode& child = *it;
		if (MakeCString(child.tagName) == pszTagBookmark)
		{
			children.push_back(Bookmark());
			Bookmark& bookmark = children.back();
			bookmark.Load(child);
		}
	}
}
コード例 #11
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Method for setting the bookmark's proxy.

@param aProxy Id for identifying the proxy entry in the commdb
@publishedPartner
@released
*/
EXPORT_C void RBkBookmark::SetProxyL(TUint32 aProxy)
	{
	CBkmrkExtendedProperties& properties = Bookmark()->BkmrkExtendedPropertiesL();
	properties.SetProxyL(aProxy);
	}
コード例 #12
0
HRESULT __stdcall CBookmarksToolbarDropHandler::Drop(IDataObject *pDataObject,
	DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
{
	FORMATETC ftc = {CF_HDROP,0,DVASPECT_CONTENT,-1,TYMED_HGLOBAL};
	STGMEDIUM stg;

	HRESULT hr = pDataObject->GetData(&ftc,&stg);

	if(hr == S_OK)
	{
		DROPFILES *pdf = reinterpret_cast<DROPFILES *>(GlobalLock(stg.hGlobal));

		if(pdf != NULL)
		{
			bool bAfter;
			int iPosition = GetToolbarPositionIndex(pt,bAfter);

			if(iPosition < 0)
			{
				iPosition = static_cast<int>(SendMessage(m_hToolbar,TB_BUTTONCOUNT,0,0));
			}
			else
			{
				if(bAfter)
				{
					iPosition++;
				}
			}

			UINT nDroppedFiles = DragQueryFile(reinterpret_cast<HDROP>(pdf),0xFFFFFFFF,NULL,NULL);

			for(UINT i = 0;i < nDroppedFiles;i++)
			{
				TCHAR szFullFileName[MAX_PATH];
				DragQueryFile(reinterpret_cast<HDROP>(pdf),i,szFullFileName,
					SIZEOF_ARRAY(szFullFileName));

				if(PathIsDirectory(szFullFileName))
				{
					TCHAR szDisplayName[MAX_PATH];
					GetDisplayName(szFullFileName,szDisplayName,SHGDN_INFOLDER);

					CBookmark Bookmark(szDisplayName,szFullFileName,EMPTY_STRING);

					auto variantBookmarksToolbar = NBookmarkHelper::GetBookmarkItem(m_AllBookmarks,m_guidBookmarksToolbar);
					assert(variantBookmarksToolbar.type() == typeid(CBookmarkFolder));
					CBookmarkFolder &BookmarksToolbarFolder = boost::get<CBookmarkFolder>(variantBookmarksToolbar);

					BookmarksToolbarFolder.InsertBookmark(Bookmark,iPosition + i);
				}
			}

			GlobalUnlock(stg.hGlobal);
		}

		ReleaseStgMedium(&stg);
	}

	RemoveInsertionMark();
	m_pDropTargetHelper->Drop(pDataObject,reinterpret_cast<POINT *>(&pt),*pdwEffect);

	return S_OK;
}
コード例 #13
0
HTMLFormattingElementList::Bookmark HTMLFormattingElementList::bookmarkFor(Element* element)
{
    size_t index = m_entries.reverseFind(element);
    ASSERT(index != notFound);
    return Bookmark(&at(index));
}
コード例 #14
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Returns the assigned authentication object. This object is based on the bookmark's URI

@return A reference to the bookmark's authentication object.
@publishedPartner
@released
*/
EXPORT_C const CAuthentication& RBkBookmark::AuthenticationL()
	{
	CBkmrkExtendedProperties& properties = Bookmark()->BkmrkExtendedPropertiesL();
	return properties.AuthenticationL();
	}
コード例 #15
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Set the bookmark's authentication object.

@param aAuthentication Reference to a new authentication object
@publishedPartner
@released
*/
EXPORT_C void RBkBookmark::SetAuthenticationL(const CAuthentication& aAuthentication)
	{
	CBkmrkExtendedProperties& properties = Bookmark()->BkmrkExtendedPropertiesL();
	properties.SetAuthenticationL(aAuthentication);
	}
コード例 #16
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Sets the last visited time for this bookmark to the time specified.
This function is intended to only be used for managing bookmarks, and will leave if not called in Management mode.
Use RBkBookmark::UpdateVisited() to set the last-modified time to the current time.

@param aTime The new visited time
@leave KErrPermissionDenied This function will leave when the bookmark database is not opened as
Bookmark::EVisibilityManager.
@publishedPartner
@released
@see RBkBookmark::UpdateVisited
*/
EXPORT_C void RBkBookmark::SetLastVisitedL(TTime aTime)
	{
	CBookmark* bookmark = Bookmark ();
	bookmark->LeaveIfNotInManagerModeL ();
	bookmark->SetLastVisited ( aTime );	
	}
コード例 #17
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Sets the last visited time to be the current time

@publishedPartner
@released
*/
EXPORT_C void RBkBookmark::UpdateVisited()
	{
	Bookmark()->UpdateVisited();
	}
コード例 #18
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Method to query whether this bookmark is the home page

@return ETrue if this bookmark is the home page
@publishedPartner
@released
*/
EXPORT_C TBool RBkBookmark::IsHomePage()
	{
	return Bookmark()->IsHomePage();
	}
コード例 #19
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Returns the last visited time for this bookmark
@return The time this bookmark was last visited
@publishedPartner
@released
*/
EXPORT_C TTime RBkBookmark::LastVisited() const
	{
	return Bookmark()->LastVisited();
	}
コード例 #20
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Method for setting the bookmark's nap.

@param aNap Id for identifying the nap entry in the commdb
@publishedPartner
@released
*/
EXPORT_C void RBkBookmark::SetNapL(TUint32 aNap)
	{
	CBkmrkExtendedProperties& properties = Bookmark()->BkmrkExtendedPropertiesL();
	properties.SetNapL(aNap);
	}
コード例 #21
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Method for getting the bookmark's nap.

@return Id for identifying the nap entry in the commdb
@publishedPartner
@released
*/
EXPORT_C TUint32 RBkBookmark::GetNapL() const
	{
	CBkmrkExtendedProperties& properties = Bookmark()->BkmrkExtendedPropertiesL();
	return properties.Nap();
	}
コード例 #22
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Method for getting the bookmark's Uri

@return Descriptor containing the Uri.
@publishedPartner
@released
*/
EXPORT_C const TDesC8& RBkBookmark::Uri() const
	{
	return Bookmark()->Uri();
	}
コード例 #23
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Method for getting the bookmark's proxy. The proxy will be set to the default proxy when
CBookmark is first created
@return Id for identifying the proxy entry in the commdb
@publishedPartner
@released
*/
EXPORT_C TUint32 RBkBookmark::ProxyL() const
	{
	CBkmrkExtendedProperties& properties = Bookmark()->BkmrkExtendedPropertiesL();
	return properties.Proxy();
	}
コード例 #24
0
ファイル: bookmark.cpp プロジェクト: kuailexs/symbiandump-mw2
/**
Method for setting the bookmark's Uri

@param aUri Descriptor containing the new Uri
@publishedPartner
@released
*/
EXPORT_C void RBkBookmark::SetUriL(const TDesC8& aUri)
	{
	Bookmark()->SetUriL(aUri);
	}