Beispiel #1
0
	void Core::SavePassword (QObject *accObj)
	{
		QVariantList keys;
		IAccount *account = qobject_cast<IAccount*> (accObj);
		keys << account->GetAccountID ();

		QVariantList passwordVar;
		passwordVar << account->GetPassword ();
		QVariantList values;
		values << QVariant (passwordVar);

		Entity e = Util::MakeEntity (keys,
				QString (),
				Internal,
				"x-leechcraft/data-persistent-save");
		e.Additional_ ["Values"] = values;
		e.Additional_ ["Overwrite"] = true;

		emit gotEntity (e);
	}
Beispiel #2
0
void CTradeLockDlg::OnBnClickedBtOk()
{
	// TODO: Add your control notification handler code here
	CString sTmp;
	m_edPsw.GetWindowText(sTmp);
	//IAccount* pAccount = m_pAccountMng->GetCurrentAccount(atTrade);
	int nIndex = m_cbFundAccount.GetCurSel();
	IAccount* pAccount = (IAccount*)m_cbFundAccount.GetItemDataPtr(nIndex);
	if (pAccount->GetConnectHandle() == 0)
	{
		pAccount->SetPassword(sTmp);
		if(pAccount->Login(sTmp))
		{
			pAccount->SetIsLocked(FALSE);
			this->GetLayoutWindow()->OpenLayout(CURRENT_LAYOUT_TARGET,LN_TRADINGPANEL,PUBLIC_OWNER);
			m_pAccountMng->SetCurrentAccount(pAccount);
		}
		else
			MessageBox(sTmp, "提示", MB_ICONINFORMATION);
	}
	else
	{
		if (pAccount->GetPassword() == sTmp)
		{
			pAccount->SetIsLocked(FALSE);
			this->GetLayoutWindow()->OpenLayout(CURRENT_LAYOUT_TARGET,LN_TRADINGPANEL,PUBLIC_OWNER);
			m_pAccountMng->SetCurrentAccount(pAccount);
		}
		else
		{
			MessageBox("密码错误!", "提示", MB_ICONINFORMATION);
			m_edPsw.SetFocus();
			m_edPsw.SetSel(0, -1);
		}
	}
	
}
Beispiel #3
0
	void AccountsSettings::addAccount (QObjectList accObjects)
	{
		IBookmarksService *ibs = qobject_cast<IBookmarksService*> (sender ());
		if (!ibs)
		{
			qWarning () << Q_FUNC_INFO
					<< sender ()
					<< "ins't IBookmarksService";
			return;
		}

		QObjectList accounts;
		Q_FOREACH (QObject *accObj, accObjects)
		{
			IAccount *account = qobject_cast<IAccount*> (accObj);
			if (Id2Account_.contains (account->GetAccountID ()))
				continue;

			if (!account->GetPassword ().isEmpty ())
				Core::Instance ().SavePassword (accObj);
			else
				account->SetPassword (Core::Instance ().GetPassword (accObj));

			Id2Account_ [account->GetAccountID ()] = accObj;

			accounts << accObj;

			const QModelIndex& index = GetServiceIndex (ibs->GetObject ());
			QStandardItem *parentItem = 0;
			if (!index.isValid ())
			{
				parentItem = new QStandardItem (ibs->GetServiceIcon (), ibs->GetServiceName ());
				parentItem->setEditable (false);
				Item2Service_ [parentItem] = ibs;
				AccountsModel_->appendRow (parentItem);
			}
			else
				parentItem = AccountsModel_->itemFromIndex (index);

			QList<QStandardItem*> record;
			QStandardItem *item = new QStandardItem (account->GetLogin ());
			item->setEditable (false);
			item->setCheckable (true);
			item->setCheckState (account->IsSyncing () ? Qt::Checked : Qt::Unchecked);

			if (account->IsSyncing ())
			{
				Core::Instance ().AddActiveAccount (accObj);
				IBookmarksService *ibs = qobject_cast<IBookmarksService*> (account->GetParentService ());
				ibs->DownloadBookmarks (account->GetObject (), account->GetLastDownloadDateTime ());
				ibs->UploadBookmarks (account->GetObject (), Core::Instance ().GetAllBookmarks ());
			}

			Item2Account_ [item] = account;

			QStandardItem *uploaditem = new QStandardItem (account->GetLastUploadDateTime ()
					.toString (Qt::DefaultLocaleShortDate));
			uploaditem->setEditable (false);

			QStandardItem *downloaditem = new QStandardItem (account->GetLastDownloadDateTime ()
					.toString (Qt::DefaultLocaleShortDate));
			uploaditem->setEditable (false);

			record << item
					<< uploaditem
					<< downloaditem;
			parentItem->appendRow (record);

			if (account->IsSyncing ())
				Core::Instance ().AddActiveAccount (accObj);

			Ui_.AccountsView_->expandAll ();

			Scheduled_ = false;
			ScheduleResize ();
		}