void ResetWidget::createContent () { MLayout *layout; MLinearLayoutPolicy *policy; MButton *restoreButton; MButton *clearButton; MSeparator *spacer; /* * */ layout = new MLayout; policy = new MLinearLayoutPolicy (layout, Qt::Vertical); policy->setContentsMargins (0., 0., 0., 0.); policy->setSpacing (0.); /* * */ spacer = new MSeparator; // Using this one instead of "CommonSpacer", margins look even. spacer->setStyleName ("CommonLargeSpacer"); policy->addItem (spacer); /* * The first button. */ //% "Restore original settings" restoreButton = new MButton (qtTrId("qtn_rset_restore")); restoreButton->setStyleName ("CommonSingleButtonInverted"); restoreButton->setObjectName ("ResetAppletRFSButton"); connect (restoreButton, SIGNAL(clicked()), this, SLOT(restoreActivated())); /* * The second button. */ //% "Clear device" clearButton = new MButton (qtTrId("qtn_rset_clear")); clearButton->setStyleName ("CommonSingleButtonInverted"); clearButton->setObjectName ("ResetAppletCUDButton"); connect (clearButton, SIGNAL(clicked()), this, SLOT(clearActivated())); addButtonContainer (policy, restoreButton, clearButton); policy->addStretch(); /* * */ layout->setPolicy (policy); setLayout (layout); }
void WarrantyWidget::addStretcher ( MLinearLayoutPolicy *mainLayout, const QString &styleName) { MSeparator *stretcher; Q_ASSERT (mainLayout); stretcher = new MSeparator (); stretcher->setStyleName (styleName); mainLayout->addItem (stretcher); }
void ConversationPage::processAttachments(const QMailMessage &message) { if (!message.status() & QMailMessageMetaData::HasAttachments) return; connect(this, SIGNAL(downloadCompleted()), this, SLOT(saveAttachment())); bool oneTimeFlag = true; for (uint i = 1; i < message.partCount(); ++i) { QMailMessagePart sourcePart = message.partAt(i); if (!(sourcePart.multipartType() == QMailMessagePartContainer::MultipartNone)) continue; if (oneTimeFlag) { MSeparator *separator = new MSeparator(); separator->setObjectName("Separator"); m_policy->addItem(separator); oneTimeFlag = false; } MStylableWidget *w = new MStylableWidget(this); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal); w->setLayout(layout); //% "Attached: " MLabel *label = new MLabel(qtTrId("xx_attached")); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); label->setObjectName ("AttachmentText"); layout->addItem(label); MButton *button = new MButton(sourcePart.displayName()); button->setObjectName ("AttachmentButton"); button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); layout->addItem(button); //% "Download..." AttachmentAction *action = new AttachmentAction(qtTrId("xx_download_context_menu"), button, sourcePart); connect(action, SIGNAL(triggered()), this, SLOT(openAttachmentDownloadDialog())); //% "Open..." action = new AttachmentAction(qtTrId("xx_open_context_menu"), button, sourcePart); connect(action, SIGNAL(triggered()), this, SLOT(openAttachmentOpenDialog())); m_policy->addItem (w); } }
void WarrantyWidget::addLabelContainer ( MLinearLayoutPolicy *mainLayout, MLabel *label1, MLabel *label2) { Q_ASSERT (mainLayout); /* * Adding the label to the layout. */ mainLayout->addItem (label1); mainLayout->setAlignment (label1, Qt::AlignLeft); MSeparator *separator = new MSeparator; separator->setStyleName ("CommonSpacer"); mainLayout->addItem (separator); mainLayout->addItem (label2); mainLayout->setAlignment (label2, Qt::AlignLeft); }
void SettingsPage::createContent() { Q_D(SettingsPage); setStyleName("AccountsUiPage"); //% "%1 settings" setTitle(qtTrId("qtn_acc_ser_prof_set_title").arg(d->context->service().name())); MWidget *upperWidget = new MWidget(this); MLayout *upperLayout = new MLayout(upperWidget); MLinearLayoutPolicy *upperLayoutPolicy = new MLinearLayoutPolicy(upperLayout, Qt::Vertical); upperLayoutPolicy->setSpacing(0); MLayout *horizontalLayout = new MLayout(); MLinearLayoutPolicy *horizontalLayoutPolicy = new MLinearLayoutPolicy(horizontalLayout, Qt::Horizontal); QString providerName(d->context->account()->providerName()); QString providerIconId; // xml file that describes the ui elements for the provider Accounts::Provider provider = AccountsManager::instance()->provider(providerName); if (provider.isValid()) { QDomElement root = provider.domDocument().documentElement(); QDomElement providerIcon = root.firstChildElement("icon"); providerIconId = providerIcon.text(); } ServiceHelper *serviceHepler = new ServiceHelper(d->context->service(), this); BasicHeaderWidget *usernameAndStatus = 0; if (d->context->account()->id() == 0) { usernameAndStatus = new BasicHeaderWidget(BasicHeaderWidget::IconWithTitle, this); usernameAndStatus->createLayout(); } else { usernameAndStatus = new BasicHeaderWidget(BasicHeaderWidget::IconWithTitleAndSubTitle, this); usernameAndStatus->createLayout(); usernameAndStatus->setSubtitle(qtTrId(d->context->account()->displayName().toLatin1())); } usernameAndStatus->setImage(providerIconId); usernameAndStatus->setTitle(serviceHepler->prettyName()); MSeparator *separatorTop = new MSeparator(this); separatorTop->setStyleName("CommonHeaderDividerInverted"); separatorTop->setOrientation(Qt::Horizontal); d->context->account()->selectService(d->context->service()); horizontalLayoutPolicy->addItem(usernameAndStatus, Qt::AlignLeft | Qt::AlignVCenter); upperLayoutPolicy->addItem(horizontalLayout); upperLayoutPolicy->addItem(separatorTop); MWidget *widget = d->context->widget(this); MWidget *centralWidget = new MWidget(this); MLayout *layout = new MLayout(centralWidget); MLinearLayoutPolicy *layoutPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical); layoutPolicy->addItem(upperWidget); layoutPolicy->addItem(widget); layoutPolicy->addStretch(); setCentralWidget(centralWidget); }
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(); } }
void ResetWidget::addButtonContainer ( MLinearLayoutPolicy *mainLayout, MButton *button1, MButton *button2) { MSeparator *spacer; QGraphicsLinearLayout *layout = new QGraphicsLinearLayout (Qt::Vertical); layout->setContentsMargins (0,0,0,0); layout->setSpacing (0); /* * One spacer */ spacer = new MSeparator; spacer->setStyleName ("CommonSpacer"); /* * Button 1 layout */ QGraphicsLinearLayout *button1layout = new QGraphicsLinearLayout (Qt::Horizontal); button1layout->setContentsMargins (0,0,0,0); button1layout->setSpacing (0); MStylableWidget *imgSpacer1 = new MStylableWidget; imgSpacer1->setStyleName ("CommonLeftIcon"); button1layout->addItem (imgSpacer1); button1layout->addStretch (); button1layout->addItem (button1); button1layout->setAlignment (button1, Qt::AlignCenter); button1layout->addStretch (); MHelpButton *hp1 = createHelpButton ("IDUG_MEEGO_SETT_RESTORE.html"); button1layout->addItem (hp1); button1layout->setAlignment (hp1, Qt::AlignVCenter); layout->addItem (button1layout); layout->setAlignment (button1layout, Qt::AlignCenter); layout->addItem (spacer); /* * Button 2 layout */ QGraphicsLinearLayout *button2layout = new QGraphicsLinearLayout (Qt::Horizontal); button2layout->setContentsMargins (0,0,0,0); button2layout->setSpacing (0); MStylableWidget *imgSpacer2 = new MStylableWidget; imgSpacer2->setStyleName ("CommonLeftIcon"); button2layout->addItem (imgSpacer2); button2layout->addStretch (); button2layout->addItem (button2); button2layout->setAlignment (button2, Qt::AlignCenter); button2layout->addStretch (); MHelpButton *hp2 = createHelpButton ("IDUG_MEEGO_SETT_CLEARDEVICE.html"); button2layout->addItem (hp2); button2layout->setAlignment (hp2, Qt::AlignVCenter); layout->addItem (button2layout); layout->setAlignment (button2layout, Qt::AlignCenter); /* * */ mainLayout->addItem (layout); mainLayout->setStretchFactor (layout, 0); }