void AccountSetupPage::createContent()
{
    MApplicationPage::createContent();
    setContentsMargins(0, 0, 0, 0);
    setPannable(true);
    //% "Mail"
    setTitle(qtTrId("xx_page_title"));

    MLayout *layout = new MLayout(centralWidget());

    MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Vertical);

    //% "New mail account"
    creatLabel (policy, ("<b>" + qtTrId("xx_new_mail_account") + "<b>"), true);

    //% "We need to take some details to setup your account."
    creatLabel (policy, qtTrId("xx_need_account_detail"), true);
     
    // Prompt the user for name
    //% "What's your name?"
    creatLabel(policy, qtTrId("xx_enter_your_name"));
    m_username = new MTextEdit(MTextEditModel::SingleLine, "", this);
    m_username->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    policy->addItem(m_username);
    policy->setItemSpacing(policy->indexOf(m_username), 5);

    // Prompt the user for email address
    //% "Email address"
    creatLabel (policy, qtTrId("xx_email_address"));
    m_emailAddress = new MTextEdit(MTextEditModel::SingleLine, "", this);
    m_emailAddress->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    policy->addItem(m_emailAddress);
    policy->setItemSpacing(policy->indexOf(m_emailAddress), 5);

    // Prompt the user for password
    //% "Password"
    creatLabel(policy, qtTrId("xx_password"));
    m_password = new MTextEdit(MTextEditModel::SingleLine, "", this);
    m_password->setEchoMode(MTextEditModel::Password);
    m_password->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    policy->addItem(m_password);
    policy->setItemSpacing(policy->indexOf(m_password), 5);

    // Setup button
    //% "Setup account"
    MButton *button = new MButton(qtTrId("xx_setup_account_button_label"), this);
    button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    connect(button, SIGNAL(clicked(bool)), this, SLOT(setupAccount()));
    policy->addItem(button);
    policy->addStretch();

    // Settings menu
    //% "Settings"
    MAction *action = new MAction(qtTrId("xx_settings_actions"), this);
    action->setLocation(MAction::ApplicationMenuLocation);
    connect(action, SIGNAL(triggered(bool)), this, SIGNAL(emailSettingsTriggered()));
    addAction(action);
}
void FoursquareAuthPage::createContent(void)
{
	MApplicationPage::createContent();
	setStyleName("CommonApplicationPage");
	setPannable(false);

	MAction *cancelAction = new MAction(tr("Cancel"), this);
	cancelAction->setLocation(MAction::ToolBarLocation);
	connect(cancelAction, SIGNAL(triggered()),
		this, SLOT(dismiss()));
	addAction(cancelAction);

	QGraphicsAnchorLayout *layout = new QGraphicsAnchorLayout();
	layout->setContentsMargins(0, 0, 0, 0);

	m_header = new ViewHeader(tr("Foursquare authentication"));

	layout->addCornerAnchors(m_header, Qt::TopLeftCorner,
				 layout, Qt::TopLeftCorner);
	layout->addCornerAnchors(m_header, Qt::TopRightCorner,
				 layout, Qt::TopRightCorner);

	QGraphicsGridLayout *subLayout = new QGraphicsGridLayout();
	layout->addCornerAnchors(subLayout, Qt::TopLeftCorner,
				 m_header, Qt::BottomLeftCorner);
 	layout->addCornerAnchors(subLayout, Qt::BottomRightCorner,
 				 layout, Qt::BottomRightCorner);

	m_view = new QGraphicsWebView();
	m_view->setResizesToContents(false);
	m_view->setSizePolicy(QSizePolicy::Ignored,
			      QSizePolicy::Ignored);
	connect(m_view, SIGNAL(loadStarted()),
		this, SLOT(pageLoadStarted()));
	connect(m_view, SIGNAL(loadFinished(bool)),
		this, SLOT(pageLoadFinished(bool)));

	subLayout->addItem(m_view, 0, 0);

	m_nam = new FoursquareAuthNetworkAccessManager(m_view->page()->networkAccessManager(), 
						       REDIRECT_URL,
						       this);
	connect(m_nam, SIGNAL(tokenReceived(QString)),
		this, SLOT(tokenReceived(QString)));

	m_view->page()->setNetworkAccessManager(m_nam);

	centralWidget()->setLayout(layout);

	Q_EMIT(created());
}
Exemple #3
0
void MainPage::createContent(void)
{
	m_bluez->start();

	MApplicationPage::createContent();
	setStyleName("CommonApplicationPage");
	setPannable(false);
	
	createObjectMenuActions();
	createActions();

	QGraphicsAnchorLayout *layout = new QGraphicsAnchorLayout();
	layout->setContentsMargins(0, 0, 0, 0);

	ViewHeader *header = new ViewHeader(tr("Stored tags"));
	layout->addCornerAnchors(header, Qt::TopLeftCorner,
				 layout, Qt::TopLeftCorner);

	LabelOrList *list = new LabelOrList(TagStorage::storage(),
					    _getTagListCellCreator,
					    tr("You don't have any "
					       "stored tags currently. "
					       "Create some or harvest "
					       "existing ones by touching "
					       "them."),
					    false,
					    false);
	list->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
	layout->addCornerAnchors(list, Qt::TopLeftCorner,
				 header, Qt::BottomLeftCorner);
	layout->addCornerAnchors(list, Qt::BottomRightCorner,
				 layout, Qt::BottomRightCorner);
	connect(list, SIGNAL(itemClicked(const QModelIndex &)),
		this, SLOT(tagSelected(const QModelIndex &)));
	connect(list, SIGNAL(itemLongTapped(const QModelIndex &,
					    const QPointF &)),
		this, SLOT(tagLongSelected(const QModelIndex &,
					   const QPointF &)));

	centralWidget()->setLayout(layout);
}
void ConversationPage::createContent()
{
    MApplicationPage::createContent();
    setContentsMargins(0, 0, 0, 0);
    setPannable(true);

    createActions();
    //% "Mail"
    setTitle(qtTrId("xx_page_title"));

    MLayout *layout = new MLayout(centralWidget());
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setAnimation(0);

    m_policy = new MLinearLayoutPolicy(layout, Qt::Vertical);
    m_policy->setObjectName("VerticalPolicy");
    m_policy->setContentsMargins(0, 0, 0, 0);
    m_policy->setSpacing(0);

    QMailMessage message(m_id);
    //% "From"
    QString body = qtTrId("xx_from") + ": " + message.from().address() + "\n";
    QStringList addresses = QMailAddress::toStringList(message.to());
    //% "To"
    body.append(qtTrId("xx_to") + ": "  + addresses.join("; ") + "\n");
    addresses = QMailAddress::toStringList(message.cc());
    if (addresses.size() > 0)
        //% "Cc"
        body.append(qtTrId("xx_cc" ) + ": " + addresses.join("; ") + "\n");
    addresses = QMailAddress::toStringList(message.bcc());
    if (addresses.size() > 0)
        //% "Bcc"
        body.append(qtTrId("xx_bcc" ) + ": " + addresses.join("; ") + "\n");

    QMailAddress replyTo = message.replyTo();
    if (!replyTo.isNull())
        //% "Reply-To"
        body.append(qtTrId("xx_reply_to") + ": " + replyTo.toString() + "\n");

    //% "Subject"
    body.append(qtTrId("xx_subject") + ": " + message.subject() + "\n");
    //% "Date: %1"
    body.append(qtTrId("xx_date").arg(message.date().toLocalTime().toString(Qt::SystemLocaleShortDate)));
    MLabel *messageBody = new MLabel(body);
    messageBody->setWordWrap(true);
    messageBody->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    messageBody->setObjectName("BodyText");
    m_policy->addItem(messageBody);

    MSeparator *separator = new MSeparator();
    separator->setObjectName("Separator");
    m_policy->addItem(separator);

    messageBody = new MLabel("\n" + Utils::bodyPlainText(&message));
    messageBody->setWordWrap(true);
    messageBody->setObjectName("BodyText");
    messageBody->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

    m_policy->addItem (messageBody);
    processAttachments(message);

    centralWidget()->setLayout(layout);
}
void CreateEditPage::createContent(void)
{
	MApplicationPage::createContent();
	setStyleName("CommonApplicationPage");
	setPannable(false);

	createActions();

	QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout();
	anchor->setContentsMargins(0, 0, 0, 0);
	anchor->setSizePolicy(QSizePolicy::Minimum, 
			      QSizePolicy::Minimum);

	ViewHeader *header = 
		new ViewHeader(m_tag == TagStorage::NULL_TAG 
			       ? tr("Create tag contents")
			       : tr("Edit tag contents"));
	anchor->addCornerAnchors(header, Qt::TopLeftCorner,
				 anchor, Qt::TopLeftCorner);

#ifdef LABEL_SIZE
	m_size = new MLabel();
	m_size->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	m_size->setAlignment(Qt::AlignRight);
	anchor->addAnchor(m_size, Qt::AnchorBottom, anchor, Qt::AnchorBottom);
	anchor->addAnchor(m_size, Qt::AnchorRight, anchor, Qt::AnchorRight);
#endif

	MWidget *layoutContainer = new MWidget();
	layoutContainer->setSizePolicy(QSizePolicy::Preferred, 
				       QSizePolicy::Minimum);
	m_layout = new QGraphicsLinearLayout(Qt::Vertical, layoutContainer);
	m_layout->setSizePolicy(QSizePolicy::Preferred, 
				QSizePolicy::Minimum);

	m_name = new LabeledTextEdit(tr("Ok"),
				     LabeledTextEdit::SingleLineEditAndLabel);
	m_name->setLabel(tr("Tag name"));
	m_name->setPrompt(tr("Enter tag name"));
	m_name->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	m_layout->addItem(m_name);
	m_layout->setAlignment(m_name, Qt::AlignLeft);
	connect(m_name, SIGNAL(contentsChanged(void)),
		this, SLOT(nameChanged(void)));

	MSeparator *sep = new MSeparator;
	sep->setStyleName("CommonHorizontalSeparator");
	sep->setOrientation(Qt::Horizontal);
	layout()->addItem(sep);

	createPageSpecificContent();

	MPannableViewport *view = new MPannableViewport();
	view->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
	view->setPanDirection(Qt::Vertical);
	view->setMinimumSize(100, 100);
	view->setWidget(layoutContainer);

	anchor->addAnchor(view, Qt::AnchorTop, header, Qt::AnchorBottom);
#ifdef LABEL_SIZE
	anchor->addAnchor(view, Qt::AnchorBottom, m_size, Qt::AnchorTop);
#else
	anchor->addAnchor(view, Qt::AnchorBottom, anchor, Qt::AnchorBottom);
#endif
	anchor->addAnchor(view, Qt::AnchorLeft, anchor, Qt::AnchorLeft);
	anchor->addAnchor(view, Qt::AnchorRight, anchor, Qt::AnchorRight);

	centralWidget()->setLayout(anchor);

	if (m_tag == TagStorage::NULL_TAG) {
		setContentValidity(false);
		setNameValidity(false);
		setupNewData();
	} else {
		load();
	}
}