void HelpPopup::DoInitDialog() {
    ToLog(LOGMSG_DEBUGTRACE,"IN:HelpPopup::DoInitDialog");

    if (HelpEngine) {
        ui->HelpBrowserWidget->HelpEngine=HelpEngine;
        ui->ContentWidget->InitHelpEngine(HelpEngine);
        ui->FollowInterfaceCB->setChecked(*WikiFollowInterface);
        ui->HelpSplitter->setStretchFactor(0,1);
        ui->HelpSplitter->setStretchFactor(1,3);

        connect(ui->HelpBrowserWidget,SIGNAL(historyChanged()),SLOT(PageChanged()));
        connect(ui->HelpBrowserWidget,SIGNAL(sourceChanged(QUrl)),SLOT(SourceChanged(QUrl)));
        connect(ui->ContentWidget,SIGNAL(clicked(QModelIndex)),this,SLOT(UpdateUrl(QModelIndex)));
        connect(ui->ContentWidget,SIGNAL(collapsed(QModelIndex)),this,SLOT(CollapsedOrExpanded(QModelIndex)));
        connect(ui->ContentWidget,SIGNAL(expanded(QModelIndex)),this,SLOT(CollapsedOrExpanded(QModelIndex)));
        connect(ui->ExitBT,SIGNAL(pressed()),this,SLOT(Exit()));
        connect(ui->PreviousBT,SIGNAL(pressed()),this,SLOT(Back()));
        connect(ui->NextBT,SIGNAL(pressed()),this,SLOT(Next()));
        connect(ui->CCBYSABT,SIGNAL(pressed()),this,SLOT(CCBYSABT()));
        connect(ui->HomeBT,SIGNAL(pressed()),this,SLOT(Home()));
        connect(ui->WebSiteBT,SIGNAL(pressed()),this,SLOT(WebSite()));
        connect(ui->ForumBT,SIGNAL(pressed()),this,SLOT(Forum()));
        connect(ui->FollowInterfaceCB,SIGNAL(clicked()),this,SLOT(Follow()));
        PageChanged();
    }
}
示例#2
0
文件: forum.cpp 项目: Azareal/cppforo
std::map<int, Forum> getAllForums()
{
	std::map<int, Forum> out;

	sql::Statement * stmt;
	sql::ResultSet * res;
	stmt = db->con->createStatement();
	res = stmt->executeQuery("SELECT * FROM " + db->prefix + "forums");

	log("Iterating over forums..");
	// Loop over the retrieved forums..
	while (res->next())
	{
		out[res->getInt("fid")] = Forum(res);
	}

	delete res;
	delete stmt;
	return out;
}
示例#3
0
bool CUserPageBuilder::Build(CWholePage* pWholePage)
{
	// introducing the players - these will point to the XML objects required
	// to construct a user page
	CPageUI			Interface(m_InputContext);
	CUser*			pViewer = NULL;
	CUser			Owner(m_InputContext);
	CGuideEntry		Masthead(m_InputContext);
	CForum			PageForum(m_InputContext);
	CForum			Journal(m_InputContext);
	CPostList		RecentPosts(m_InputContext);
	CArticleList	RecentArticles(m_InputContext);
	CArticleList	RecentApprovals(m_InputContext);
	CCommentsList	RecentComments(m_InputContext);
	CArticleSubscriptionList	SubscribedUsersArticles(m_InputContext);
	
	CTDVString	sSecretKey;
	int			iSecretKey = 0;
	int			iUserID = 0;		// the user ID in the URL
	bool		bRegistering = false;
	bool		bSuccess = true;	// our success flag

	// get the user ID from the URL => zero if not present
	// TODO: something appropriate if no ID provided	
	iUserID = m_InputContext.GetParamInt("UserID");
	// now get the secret key if there is one
	// we may need to process it so get it as a string
	if (m_InputContext.GetParamString("Key", sSecretKey))
	{
		// if the secret key start with "3D" we must strip this off
		// - it is caused by a mime encoding problem, 3D is the ascii hex for =
		if (sSecretKey.Find("3D") == 0)
		{
			sSecretKey =  sSecretKey.Mid(2);
		}
		iSecretKey = atoi(sSecretKey);
		if (iSecretKey > 0)
		{
			// if there is a secret key then it is a registration attempt
			bRegistering = true;
		}
	}
	// now give appropriate page depending on whether this is a registration or not
	if (bRegistering)
	{
//		CStoredProcedure* pSP = m_InputContext.CreateStoredProcedureObject();
		CTDVString sPageContent = "";
		CTDVString sPageSubject = "";
//		CTDVString sCookie;

		// check we got our SP okay
//		if (pSP == NULL)
//		{
//			bSuccess = false;
//		}
		// if so then call the activate user method, which should return us a nice
		// warm cookie if all goes well
//		if (bSuccess)
//		{
//			bSuccess = pSP->ActivateUser(iUserID, iSecretKey, &sCookie);
			// make sure cookie is not empty
//			if (sCookie.IsEmpty())
//			{
//				bSuccess = false;
//			}
//		}
		// if okay then build page with the cookie in and a message to the user
		if (bSuccess)
		{
			// we have a cookie and we are prepared to use it
			// TODO: what about the MEMORY tag?
			// TODO: put this in stylesheet? Deal with delayed refresh?
//			CTDVString sCookieXML = "<SETCOOKIE><COOKIE>" + sCookie + "</COOKIE></SETCOOKIE>";

//			sPageSubject = "Registration in process ...";
//			sPageContent << "<GUIDE><BODY>";
//			sPageContent << "<P>Thank you for registering as an official Researcher for The Hitch Hiker's ";
//			sPageContent << "Guide to the Galaxy: we do hope you enjoy contributing to the Guide.</P>";
//			sPageContent << "<P>Please wait while you are transferred to <LINK BIO=\"U" << iUserID << "\">";
//			sPageContent << "your Personal Home Page</LINK> ... or click the link if nothing happens.</P>";
//			sPageContent << "</BODY></GUIDE>";
//			pWholePage = CreateSimplePage(sPageSubject, sPageContent);
//			if (pWholePage == NULL)
//			{
//				bSuccess = false;
//			}

			if (bSuccess)
			{
				bSuccess = InitPage(pWholePage, "USERPAGE",false);
			}
			// put the cookie xml inside the H2G2 tag
//			bSuccess = pWholePage->AddInside("H2G2", sCookieXML);

//			CTDVString sUserXML = "";
//			sUserXML << "<REGISTERING-USER>";
//			sUserXML << "<USER>";
//			sUserXML << "<USERNAME></USERNAME>";
//			sUserXML << "<USERID>" << iUserID << "</USERID>";
//			sUserXML << "</USER>";
//			sUserXML << "</REGISTERING-USER>";
//			bSuccess = pWholePage->AddInside("H2G2", sUserXML);
//			bSuccess = bSuccess && pWholePage->SetPageType("REGISTER-CONFIRMATION");

		CTDVString sRedirect;
		sRedirect << "ShowTerms" << iUserID;
		sRedirect << "?key=" << sSecretKey;
		pWholePage->Redirect(sRedirect);
		}
		else
		{
			sPageSubject = "Sorry ...";
			sPageContent << "<GUIDE><BODY>";
			sPageContent << "<P>The URL you've given is wrong. Please re-check your email, or <LINK HREF=\"/Register\">click here to re-enter your email address</LINK>.</P>";
			sPageContent << "</BODY></GUIDE>";
			bSuccess = CreateSimplePage(pWholePage, sPageSubject, sPageContent);
		}
		// make sure we delete the SP if any
//		delete pSP;
//		pSP = NULL;
	}
	else
	{
		// get or create all the appropriate xml objects
		pViewer		= m_InputContext.GetCurrentUser();
		bool bGotMasthead = false; 
		bool bGotPageForum = false; 
		bool bGotJournal = false; 
		bool bGotRecentPosts = false; 
		bool bGotRecentArticles = false; 
		bool bGotRecentApprovals = false; 
		bool bGotRecentComments = false; 
		bool bGotSubscribedToUsersRecentArticles = false; 

		bool bGotOwner		= CreatePageOwner(iUserID, Owner);

		CreatePageTemplate(pWholePage);
		if (m_InputContext.IncludeUsersGuideEntryInPersonalSpace() || (m_InputContext.GetParamInt("i_uge") == 1) ||
			m_InputContext.IncludeUsersGuideEntryForumInPersonalSpace() || (m_InputContext.GetParamInt("i_ugef") == 1))
		{
			bGotMasthead = CreatePageArticle(iUserID, Owner, Masthead);

			if (m_InputContext.IncludeUsersGuideEntryForumInPersonalSpace() || (m_InputContext.GetParamInt("i_ugef") == 1))
			{
				// GuideEntry forum can not be returned if GuideEntry is not being returned.
				bGotPageForum = CreatePageForum(pViewer, Masthead, PageForum);
			}
		}

		bool bGotInterface = CreateUserInterface(pViewer, Owner, Masthead, Interface);
		
		// Only display other information if the page has a valid masthead
		if (bGotMasthead)
		{
			if (m_InputContext.IncludeJournalInPersonalSpace() || (m_InputContext.GetParamInt("i_j") == 1))
			{
				bGotJournal = CreateJournal(Owner, pViewer, Journal);
			}

			if (m_InputContext.IncludeRecentPostsInPersonalSpace() || (m_InputContext.GetParamInt("i_rp") == 1))
			{
				bGotRecentPosts = CreateRecentPosts(Owner, pViewer, RecentPosts);
			}

			if (m_InputContext.IncludeRecentCommentsInPersonalSpace() || (m_InputContext.GetParamInt("i_rc") == 1))
			{
				bGotRecentComments = CreateRecentComments(Owner, pViewer, RecentComments);
			}

			if (m_InputContext.IncludeRecentGuideEntriesInPersonalSpace() || (m_InputContext.GetParamInt("i_rge") == 1))
			{
				bGotRecentArticles = CreateRecentArticles(Owner, RecentArticles);
				bGotRecentApprovals = CreateRecentApprovedArticles(Owner, RecentApprovals);
			}

			if (m_InputContext.IncludeUploadsInPersonalSpace() || (m_InputContext.GetParamInt("i_u") == 1))
			{
				CTDVString sUploadsXML;
				CUpload Upload(m_InputContext);
				Upload.GetUploadsForUser(iUserID,sUploadsXML);
				pWholePage->AddInside("H2G2",sUploadsXML);
			}

			if (m_InputContext.IncludeRecentArticlesOfSubscribedToUsersInPersonalSpace() || (m_InputContext.GetParamInt("i_rasu") == 1))
			{
				bGotSubscribedToUsersRecentArticles = CreateSubscribedToUsersRecentArticles(Owner, m_InputContext.GetSiteID(), SubscribedUsersArticles); 
			}
		}

		// See if the user wants to swap to this site and change their masthead and journal (if it exists)
/*
	This feature is now redundant. There's no concept of a homesite.
		if (m_InputContext.ParamExists("homesite"))
		{
			if (pViewer == NULL)
			{
				// error: Not registered - ignore request
			}
			else if (!bGotOwner)
			{
				// error - no actual owner, ignore request
			}
			else if (pViewer->GetIsEditor())
			{
				int iCurrentSiteID = m_InputContext.GetSiteID();
				int iThisSite = iCurrentSiteID;
				if (bGotMasthead)
				{
					iCurrentSiteID = Masthead.GetSiteID();
				}
				if ( iThisSite != iCurrentSiteID && m_InputContext.CanUserMoveToSite(iCurrentSiteID, iThisSite))
				{
					CStoredProcedure SP;
					m_InputContext.InitialiseStoredProcedureObject(&SP);
					if (bGotMasthead)
					{
						SP.MoveArticleToSite(Masthead.GetH2G2ID(), m_InputContext.GetSiteID());
						//delete pMasthead;
						Masthead.Destroy();
						bGotMasthead = CreatePageArticle(iUserID, Owner, Masthead);
					}
					int iJournal;
					Owner.GetJournal(&iJournal);
					if (iJournal > 0)
					{
						SP.MoveForumToSite(iJournal, m_InputContext.GetSiteID());
					}

					int iPrivateForum;
					if (Owner.GetPrivateForum(&iPrivateForum))
					{
						SP.MoveForumToSite(iPrivateForum, m_InputContext.GetSiteID());
					}
					pWholePage->AddInside("H2G2", "<SITEMOVED RESULT='success'/>");
				}
			}
		}
*/
		// check that all the *required* objects have been created successfully
		// note that pViewer can be NULL if an unregistered viewer
		// pOwner can be NULL if we are serving a default page because this user ID
		// does not exist
		// bGotJournal can be false if the user doesn't exist, or has no journal
		// bGotRecentPosts can be false if the user doesn't exist
		// pRecentArticles can be NULL if the user doesn't exist
		// pRecentApprovals can be NULL if the user doesn't exist
		// bGotPageForum can be false if there is no masthead, or if it has no forum yet
		// pMasthead could be NULL if the user has not created one yet
		if (pWholePage->IsEmpty() || bGotInterface == false)
		{
			bSuccess = false;
		}
		// now add all the various subcomponents into the whole page xml
		// add owner of page
		if (bSuccess)
		{
			// if we have a page owner then put their details in, otherwise make
			// up a pretend user from the ID we were given
			if (bGotOwner)
			{
				bSuccess = pWholePage->AddInside("PAGE-OWNER", &Owner);
			}
			else
			{
				CTDVString sPretendUserXML = "";
				sPretendUserXML << "<USER><USERID>" << iUserID << "</USERID>";
				sPretendUserXML << "<USERNAME>Researcher " << iUserID << "</USERNAME></USER>";
				bSuccess = pWholePage->AddInside("PAGE-OWNER", sPretendUserXML);
			}
		}
		// there should always be an interface but check anyway
		if (bSuccess && bGotInterface)
		{
			bSuccess = pWholePage->AddInside("H2G2", &Interface);
		}
		if (bSuccess && m_InputContext.ParamExists("clip"))
		{
			CTDVString sSubject;
			if (bGotOwner)
			{
				Owner.GetUsername(sSubject);
			}
			else
			{
				sSubject << "U" << iUserID;
			}

			bool bPrivate = m_InputContext.GetParamInt("private") > 0;
			CLink Link(m_InputContext);
			if ( Link.ClipPageToUserPage("userpage", iUserID, sSubject, NULL, pViewer, bPrivate) )
				pWholePage->AddInside("H2G2", &Link);
		}
		// if masthead NULL stylesheet should do the default response
		if (bSuccess && bGotMasthead && (m_InputContext.IncludeUsersGuideEntryInPersonalSpace() || (m_InputContext.GetParamInt("i_uge") == 1)))
		{
			bSuccess = pWholePage->AddInside("H2G2", &Masthead);
		}
		// add page forum if there is one => this is the forum associated with
		// the guide enty that is the masthead for this user
		if (bSuccess && bGotPageForum && (m_InputContext.IncludeUsersGuideEntryForumInPersonalSpace() || (m_InputContext.GetParamInt("i_ugef") == 1)))
		{
			bSuccess = pWholePage->AddInside("H2G2", &PageForum);
		}
		// add journal if it exists
		if (bSuccess && bGotJournal)
		{
			bSuccess = pWholePage->AddInside("JOURNAL", &Journal);
		}
		// add recent posts if they exist, this may add an empty
		// POST-LIST tag if the user exists but has never posted
		if (bSuccess && bGotRecentPosts)
		{
			bSuccess = pWholePage->AddInside("RECENT-POSTS", &RecentPosts);
		}
		// add recent articles if they exist, this may add an empty
		// ARTICLES-LIST tag if the user exists but has never written a guide entry
		if (bSuccess && bGotRecentArticles)
		{
			bSuccess = pWholePage->AddInside("RECENT-ENTRIES", &RecentArticles);
			// add the user XML for the owner too
			if (bGotOwner)
			{
				bSuccess = bSuccess && pWholePage->AddInside("RECENT-ENTRIES", &Owner);
			}
		}
		// add recent articles if they exist, this may add an empty
		// ARTICLES-LIST tag if the user exists but has never had an entry approved
		if (bSuccess && bGotRecentApprovals)
		{
			bSuccess = pWholePage->AddInside("RECENT-APPROVALS", &RecentApprovals);
			// add the user XML for the owner too
			if (bGotOwner)
			{
				bSuccess = bSuccess && pWholePage->AddInside("RECENT-APPROVALS", &Owner);
			}
		}
		// add recent comments if they exist, this may add an empty
		// COMMENTS-LIST tag if the user exists but has never posted
		if (bSuccess && bGotRecentComments)
		{
			bSuccess = pWholePage->AddInside("RECENT-COMMENTS", &RecentComments);
		}

		if (bSuccess && bGotSubscribedToUsersRecentArticles)
		{
			bSuccess = pWholePage->AddInside("RECENT-SUBSCRIBEDARTICLES", &SubscribedUsersArticles);
		}

		CTDVString sSiteXML;
		m_InputContext.GetSiteListAsXML(&sSiteXML);
		bSuccess = bSuccess && pWholePage->AddInside("H2G2", sSiteXML);

		if (bGotMasthead && (m_InputContext.IncludeWatchInfoInPersonalSpace() || (m_InputContext.GetParamInt("i_wi") == 1)))
		{
			CWatchList WatchList(m_InputContext);
			bSuccess = bSuccess && WatchList.Initialise(iUserID);
			bSuccess = bSuccess && pWholePage->AddInside("H2G2",&WatchList);
			int iSiteID = m_InputContext.GetSiteID();
			bSuccess = bSuccess && WatchList.WatchingUsers(iUserID, iSiteID);
			bSuccess = bSuccess && pWholePage->AddInside("H2G2",&WatchList);
		}

		CWhosOnlineObject Online(m_InputContext);
		bSuccess = bSuccess && Online.Initialise(NULL, 1, true);
		bSuccess = bSuccess && pWholePage->AddInside("H2G2", &Online);

		if (bGotMasthead && (m_InputContext.IncludeClubsInPersonalSpace() || (m_InputContext.GetParamInt("i_c") == 1)))
		{
			if (pViewer != NULL && pViewer->GetUserID() == iUserID) 
			{
				CClub Club(m_InputContext);
				Club.GetUserActionList(iUserID, 0, 20);
				pWholePage->AddInside("H2G2", &Club);
			}

			// Now add all the clubs the user belongs to
			CCurrentClubs Clubs(m_InputContext);
			if (bSuccess && Clubs.CreateList(iUserID,true))
			{
				bSuccess = pWholePage->AddInside("H2G2",&Clubs);
			}
		}
		
		if (bGotMasthead && bSuccess && (m_InputContext.IncludePrivateForumsInPersonalSpace() || (m_InputContext.GetParamInt("i_pf") == 1)))
		{
			pWholePage->AddInside("H2G2", "<PRIVATEFORUM/>");
			CForum Forum(m_InputContext);
			int iPrivateForum = 0;
			if (bGotOwner)
			{
				Owner.GetPrivateForum(&iPrivateForum);
			}
			Forum.GetThreadList(pViewer, iPrivateForum, 10,0);
			pWholePage->AddInside("PRIVATEFORUM", &Forum);

			// Now check to see if the user has alerts set for their private forum
			if (bGotOwner)
			{
				CEmailAlertList Alert(m_InputContext);
				Alert.GetUserEMailAlertSubscriptionForForumAndThreads(iUserID,iPrivateForum);
				pWholePage->AddInside("PRIVATEFORUM", &Alert);
			}
		}

		if (bGotMasthead && bSuccess && (m_InputContext.IncludeLinksInPersonalSpace() || (m_InputContext.GetParamInt("i_l") == 1)))
		{
			CTDVString sLinkGroup;
			m_InputContext.GetParamString("linkgroup", sLinkGroup);
			if (bGotOwner && pViewer != NULL && Owner.GetUserID() == pViewer->GetUserID()) 
			{
				ManageClippedLinks(pWholePage);
			}
			if (bGotOwner)
			{
				CLink Link(m_InputContext);
				bool bShowPrivate = (pViewer != NULL && Owner.GetUserID() == pViewer->GetUserID());
				Link.GetUserLinks(Owner.GetUserID(), sLinkGroup, bShowPrivate);
				pWholePage->AddInside("H2G2", &Link);
				Link.GetUserLinkGroups(Owner.GetUserID());
				pWholePage->AddInside("H2G2", &Link);
			}
		}

		if (bGotMasthead && m_InputContext.IncludeTaggedNodesInPersonalSpace() || (m_InputContext.GetParamInt("i_tn") == 1))
		{
			//Get the Users Crumtrail - all the nodes + ancestors the user is tagged to .
			CCategory CCat(m_InputContext);
			if ( bSuccess && CCat.GetUserCrumbTrail(Owner.GetUserID()) )
			{
				bSuccess = pWholePage->AddInside("H2G2",&CCat);
			}
		}

		if (bSuccess && bGotMasthead)
		{
			CTDVString sPostCodeXML;
			CTDVString sNoticeXML;
			if (m_InputContext.IncludeNoticeboardInPersonalSpace() || (m_InputContext.GetParamInt("i_n") == 1) ||
				m_InputContext.IncludePostcoderInPersonalSpace() || (m_InputContext.GetParamInt("i_p") == 1))
			{
				if (pViewer != NULL)
				{
					// Insert the notice board information!
					CTDVString sPostCodeToFind;
					if(pViewer->GetPostcode(sPostCodeToFind))
					{
						int iSiteID = m_InputContext.GetSiteID();
						CNotice Notice(m_InputContext);
						if (!Notice.GetLocalNoticeBoardForPostCode(sPostCodeToFind,iSiteID,sNoticeXML,sPostCodeXML))
						{
							sNoticeXML << "<NOTICEBOARD><ERROR>FailedToFindLocalNoticeBoard</ERROR></NOTICEBOARD>";
						}
					}
					else
					{
						//if the user has not entered a postcode then flag an Notice Board error
						sNoticeXML << "<NOTICEBOARD><ERROR>UserNotEnteredPostCode</ERROR></NOTICEBOARD>";
					}
				}
				else
				{
					sNoticeXML << "<NOTICEBOARD><ERROR>UserNotLoggedIn</ERROR></NOTICEBOARD>";
				}

				if (m_InputContext.IncludeNoticeboardInPersonalSpace() || (m_InputContext.GetParamInt("i_n") == 1))
				{
					bSuccess = pWholePage->AddInside("H2G2",sNoticeXML);
				}
			}

			if (m_InputContext.IncludePostcoderInPersonalSpace() || (m_InputContext.GetParamInt("i_p") == 1))
			{
				// Insert the postcoder if it's not empty
				if (bSuccess && !sPostCodeXML.IsEmpty())
				{
					bSuccess = bSuccess && pWholePage->AddInside("H2G2",sPostCodeXML);
				}
			}
		}

		if (m_InputContext.IncludeSiteOptionsInPersonalSpace() || (m_InputContext.GetParamInt("i_so") == 1))
		{
			// Return SiteOption SystemMessageOn if set. 
			if (bSuccess && m_InputContext.IsSystemMessagesOn(m_InputContext.GetSiteID()))
			{
				CTDVString sSiteOptionSystemMessageXML = "<SITEOPTION><NAME>UseSystemMessages</NAME><VALUE>1</VALUE></SITEOPTION>"; 

				bSuccess = bSuccess && pWholePage->AddInside("H2G2",sSiteOptionSystemMessageXML);
			}
		}
		
/*
		Mark Howitt 11/8/05 - Removing the civic data from the user page as it is nolonger used by any sites.
							  The only place civic data is used now is on the postcoder page.

		//include civic data
		if (bSuccess)
		{
			if ( m_InputContext.GetSiteID( ) == 16 )
			{
				CTDVString sActualPostCode;				
				bool bFoundLocalInfo = false;
				// First check to see if there is a postcode in the URL
				if (m_InputContext.ParamExists("postcode"))
				{
					// Get the postcode and use this to display the noticeboard
					if (m_InputContext.GetParamString("postcode", sActualPostCode))
					{
						//dont do any validations
						bFoundLocalInfo = true;				
					}
				}

				//next if no postcode variable is included in URL
				//or if the specified postcode value is invalid 
				//or if the specified postcode value has no entries on the db				
				if (!bFoundLocalInfo)
				{
					// No postcode given, try to get the viewing users postcode if we have one.
					if (pViewer)
					{
						if (pViewer->GetPostcode(sActualPostCode))
						{
							if ( sActualPostCode.IsEmpty( ) == false)
							{
								//dont do any validations
								bFoundLocalInfo = true;
							}
						}							
					}
					else
					{
						//try session cookie, if any 
						CTDVString sPostCodeToFind;
						CPostcoder postcoder(m_InputContext);
						CTDVString sActualPostCode = postcoder.GetPostcodeFromCookie();
						if ( !sActualPostCode.IsEmpty() )
						{
							//dont do any validations
							bFoundLocalInfo = true;
						}
					}
				}

				if ( bFoundLocalInfo )
				{
					if (!sActualPostCode.IsEmpty())
					{
						bool bHitPostcode = false;
						CPostcoder cPostcoder(m_InputContext);
						cPostcoder.MakePlaceRequest(sActualPostCode, bHitPostcode);
						if (bHitPostcode)
						{
							CTDVString sXML = "<CIVICDATA POSTCODE='";
							sXML << sActualPostCode << "'/>";
							pWholePage->AddInside("H2G2", sXML);
							bSuccess = pWholePage->AddInside("CIVICDATA",&cPostcoder);
						}
					}
				}
			}
		}
*/
	}

	return bSuccess;
}
示例#4
0
/** "Help message" or "About" dialog box */
HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
    QDialog(parent),
    ui(new Ui::HelpMessageDialog)
{
    ui->setupUi(this);
    this->setWindowModality(Qt::NonModal);
            
    GUIUtil::restoreWindowGeometry("nHelpMessageDialogWindow", this->size(), this);

    QString version = tr("Bitcredit Core") + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion());
    /* On x86 add a bit specifier to the version so that users can distinguish between
     * 32 and 64 bit builds. On other architectures, 32/64 bit may be more ambigious.
     */
#if defined(__x86_64__)
    version += " " + tr("(%1-bit)").arg(64);
#elif defined(__i386__ )
    version += " " + tr("(%1-bit)").arg(32);
#endif

    if (about)
    {
        setWindowTitle(tr("About Bitcredit Core"));

        /// HTML-format the license message from the core
        QString licenseInfo = QString::fromStdString(LicenseInfo());
        QString licenseInfoHTML = licenseInfo;
        // Make URLs clickable
        QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
        uri.setMinimal(true); // use non-greedy matching
        licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>");
        // Replace newlines with HTML breaks
        licenseInfoHTML.replace("\n\n", "<br><br>");

        //ui->helpMessage->setTextFormat(Qt::RichText);
        //ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        text = version + "\n" + licenseInfo;
        ui->helpMessage->setText(version + "<br><br>" + licenseInfoHTML);
        //ui->helpMessage->setWordWrap(true);
        
        connect(ui->pushButtonBCT, SIGNAL(clicked()), this, SLOT(BCT()));
        connect(ui->pushButtonForum, SIGNAL(clicked()), this, SLOT(Forum()));
        connect(ui->pushButtonWiki, SIGNAL(clicked()), this, SLOT(Wiki()));
        connect(ui->pushButtonExplorer, SIGNAL(clicked()), this, SLOT(Explorer()));
       
        
        
        
    } else {
        setWindowTitle(tr("Command-line options"));
        QString header = tr("Usage:") + "\n" +
            "  bitcredit-qt [" + tr("command-line options") + "]                     " + "\n";

        QString coreOptions = QString::fromStdString(HelpMessage(HMM_BITCREDIT_QT));

        QString uiOptions = tr("UI options") + ":\n" +
            "  -choosedatadir            " + tr("Choose data directory on startup (default: 0)") + "\n" +
            "  -lang=<lang>              " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
            "  -min                      " + tr("Start minimized") + "\n" +
            "  -rootcertificates=<file>  " + tr("Set SSL root certificates for payment request (default: -system-)") + "\n" +
            "  -splash                   " + tr("Show splash screen on startup (default: 1)");

        ui->helpMessage->setFont(GUIUtil::bitcreditAddressFont());
        text = version + "\n" + header + "\n" + coreOptions + "\n" + uiOptions;
        ui->helpMessage->setText(text);
    }
}