QString EmailMessageListModel::bodyHtmlText(QMailMessagePartContainer *container) const { QMailMessageContentType contentType = container->contentType(); if (container->multipartType() == QMailMessagePartContainerFwd::MultipartNone) { if (contentType.subType().toLower() == "html") { if (container->hasBody() && container->body().data().size() > 1) return container->body().data(); else { connect (m_retrievalAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), this, SLOT(downloadActivityChanged(QMailServiceAction::Activity))); QMailMessage *msg = (QMailMessage *)container; QMailMessageIdList ids; ids << msg->id(); m_retrievalAction->retrieveMessages(ids, QMailRetrievalAction::Content); return " "; // Put a space here as a place holder to notify UI that we do have html body. // Should find a better way. } } return ""; } if (!container->contentAvailable()) { // if content is not available, attempts to downlaod from the server. connect (m_retrievalAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), this, SLOT(downloadActivityChanged(QMailServiceAction::Activity))); QMailMessage *msg = (QMailMessage *)container; QMailMessageIdList ids; ids << msg->id(); m_retrievalAction->retrieveMessages(ids, QMailRetrievalAction::Content); return " "; // Put a space here as a place holder to notify UI that we do have html body. } QString text(""); for ( uint i = 0; i < container->partCount(); i++ ) { QMailMessagePart messagePart = container->partAt(i); contentType = messagePart.contentType(); if (contentType.type().toLower() == "text" && contentType.subType().toLower() == "html") { if (messagePart.hasBody()) { text += messagePart.body().data(); } else { connect (m_retrievalAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), this, SLOT(downloadActivityChanged(QMailServiceAction::Activity))); QMailMessagePart::Location location = messagePart.location(); m_retrievalAction->retrieveMessagePart(location); text = " "; break; } } QMailMessagePart subPart; for (uint j = 0; j < messagePart.partCount(); j++) { subPart = messagePart.partAt(j); contentType = subPart.contentType(); if (contentType.type().toLower() == "text" && contentType.subType().toLower() == "html") { if (subPart.hasBody()) { text += subPart.body().data(); } else { connect (m_retrievalAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), this, SLOT(downloadActivityChanged(QMailServiceAction::Activity))); QMailMessagePart::Location location = subPart.location(); m_retrievalAction->retrieveMessagePart(location); text = " "; break; } } } } return text; }
AccountSettings::AccountSettings(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags), preExisting(false), deleteBatchSize(0), deleteProgress(0) { setWindowTitle(tr("Accounts")); QVBoxLayout *vb = new QVBoxLayout(this); vb->setContentsMargins(0, 0, 0, 0); accountModel = new QMailAccountListModel(this); accountModel->setKey(QMailAccountKey::status(QMailAccount::UserEditable, QMailDataComparator::Includes)); accountModel->setSortKey(QMailAccountSortKey::id(Qt::AscendingOrder)); connect(accountModel,SIGNAL(rowsInserted(QModelIndex,int,int)),this,SLOT(updateActions())); connect(accountModel,SIGNAL(rowsRemoved(QModelIndex,int,int)),this,SLOT(updateActions())); accountView = new QListView(this); accountView->setContextMenuPolicy(Qt::ActionsContextMenu); accountView->setModel(accountModel); if (accountModel->rowCount()) accountView->setCurrentIndex(accountModel->index(0, 0)); else //no accounts so automatically add QTimer::singleShot(0,this,SLOT(addAccount())); addAccountAction = new QAction( Qtmail::icon("add"), tr("New"), this ); connect(addAccountAction, SIGNAL(triggered()), this, SLOT(addAccount())); editAccountAction = new QAction(Qtmail::icon("settings"),tr("Edit"), this); connect(editAccountAction,SIGNAL(triggered()),this,SLOT(editCurrentAccount())); accountView->addAction(editAccountAction); resetAccountAction = new QAction( Qtmail::icon("reset"), tr("Reset"), this ); connect(resetAccountAction, SIGNAL(triggered()), this, SLOT(resetAccount())); accountView->addAction(resetAccountAction); removeAccountAction = new QAction( Qtmail::icon("remove"), tr("Remove"), this ); connect(removeAccountAction, SIGNAL(triggered()), this, SLOT(removeAccount())); accountView->addAction(removeAccountAction); QToolBar *buttonBar = new QToolBar(this); buttonBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); buttonBar->addAction(addAccountAction); buttonBar->addSeparator(); buttonBar->addAction(editAccountAction); buttonBar->addAction(resetAccountAction); buttonBar->addAction(removeAccountAction); vb->addWidget(buttonBar); vb->addWidget(accountView); statusDisplay = new StatusBar(this); statusDisplay->setDetailsButtonVisible(false); statusDisplay->setVisible(false); vb->addWidget(statusDisplay); connect(accountView, SIGNAL(activated(QModelIndex)), this, SLOT(editCurrentAccount())); retrievalAction = new QMailRetrievalAction(this); connect(retrievalAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), this, SLOT(activityChanged(QMailServiceAction::Activity))); connect(retrievalAction, SIGNAL(progressChanged(uint, uint)), this, SLOT(displayProgress(uint, uint))); transmitAction = new QMailTransmitAction(this); connect(transmitAction, SIGNAL(activityChanged(QMailServiceAction::Activity)), this, SLOT(activityChanged(QMailServiceAction::Activity))); connect(transmitAction, SIGNAL(progressChanged(uint, uint)), this, SLOT(displayProgress(uint, uint))); }
void EntryBase::HandlePEPEvent (QString variant, PEPEventBase *event) { const QStringList& vars = Variants (); if (!vars.isEmpty () && (!vars.contains (variant) || variant.isEmpty ())) variant = vars.first (); if (UserActivity *activity = dynamic_cast<UserActivity*> (event)) { if (activity->GetGeneral () == UserActivity::GeneralEmpty) Variant2ClientInfo_ [variant].remove ("user_activity"); else { QMap<QString, QVariant> activityMap; activityMap ["general"] = activity->GetGeneralStr (); activityMap ["specific"] = activity->GetSpecificStr (); activityMap ["text"] = activity->GetText (); Variant2ClientInfo_ [variant] ["user_activity"] = activityMap; } emit activityChanged (variant); return; } if (UserMood *mood = dynamic_cast<UserMood*> (event)) { if (mood->GetMood () == UserMood::MoodEmpty) Variant2ClientInfo_ [variant].remove ("user_mood"); else { QMap<QString, QVariant> moodMap; moodMap ["mood"] = mood->GetMoodStr (); moodMap ["text"] = mood->GetText (); Variant2ClientInfo_ [variant] ["user_mood"] = moodMap; } emit moodChanged (variant); return; } if (UserTune *tune = dynamic_cast<UserTune*> (event)) { if (tune->IsNull ()) Variant2ClientInfo_ [variant].remove ("user_tune"); else { QMap<QString, QVariant> tuneMap; tuneMap ["artist"] = tune->GetArtist (); tuneMap ["source"] = tune->GetSource (); tuneMap ["title"] = tune->GetTitle (); tuneMap ["track"] = tune->GetTrack (); tuneMap ["URI"] = tune->GetURI (); tuneMap ["length"] = tune->GetLength (); tuneMap ["rating"] = tune->GetRating (); Variant2ClientInfo_ [variant] ["user_tune"] = tuneMap; } emit tuneChanged (variant); return; } if (UserLocation *location = dynamic_cast<UserLocation*> (event)) { Location_ [variant] = location->GetInfo (); emit locationChanged (variant, this); emit locationChanged (variant); return; } if (PEPMicroblog *microblog = dynamic_cast<PEPMicroblog*> (event)) { emit gotNewPost (*microblog); return; } if (dynamic_cast<UserAvatarData*> (event) || dynamic_cast<UserAvatarMetadata*> (event)) return; qWarning () << Q_FUNC_INFO << "unhandled PEP event from" << GetJID () << "resource" << variant; }
void ptToolBox::createGui() { GInfo->Assert(FBodyWidget, "The toolbox cannot have a null body widget.", AT); GInfo->Assert(FFilter, "The filter associated with the toolbox cannot be null.", AT); this->setObjectName(FFilter->uniqueName()); FIsFolded = Settings->m_IniSettings->value(this->objectName() + "/Folded", true).toBool(); FHeaderWidget = new QWidget; FHeaderWidget->setContextMenuPolicy(Qt::NoContextMenu); // event filter handles context menu FHeaderWidget->installEventFilter(this); // The header contains from left to right: // left-justified: FStatusArrow, FCaption; right-justified: FHelpIcon, FSlowIcon FStatusArrow = new QLabel; connect(FFilter, SIGNAL(activityChanged()), this, SLOT(updateGui())); FCaption = new QLabel(FFilter->caption()); FCaption->setTextFormat(Qt::PlainText); FCaption->setTextInteractionFlags(Qt::NoTextInteraction); auto hFont = FCaption->font(); hFont.setBold(true); FCaption->setFont(hFont); FHelpIcon = new QLabel; FHelpIcon->setPixmap(*Theme->ptIconQuestion); FHelpIcon->setCursor(QCursor(Qt::PointingHandCursor)); FHelpIcon->setToolTip(tr("Open help page in web browser.")); FHelpIcon->hide(); FHelpIcon->installEventFilter(this); FSlowIcon = new QLabel; FSlowIcon->setPixmap(QPixmap(QString::fromUtf8(":/dark/ui-graphics/bubble-attention.png"))); FSlowIcon->setToolTip(tr("Complex filter. Might be slow.")); FSlowIcon->hide(); // layout for the header auto hHeaderLayout = new QHBoxLayout(FHeaderWidget); hHeaderLayout->addWidget(FStatusArrow); hHeaderLayout->addWidget(FCaption); hHeaderLayout->addStretch(); hHeaderLayout->addWidget(FHelpIcon); hHeaderLayout->addWidget(FSlowIcon); hHeaderLayout->setContentsMargins(3,3,3,3); hHeaderLayout->setSpacing(4); // body widget with the main filter config widgets FBodyWidget->setParent(this); FBodyWidget->setObjectName("ToolBoxBody"); FBodyWidget->setVisible(!FIsFolded); // Toolbox handles margins and spacing of the body widget’s main layout to ensure consistency. auto hBodyLayout = FBodyWidget->layout(); GInfo->Assert(hBodyLayout, QString("Error! GUI widget of filter \"%1\" does not have a layout.") .arg(FFilter->uniqueName()), AT); hBodyLayout->setContentsMargins(8,5,2,5); hBodyLayout->setSpacing(4); // assemble the toolbox: place header and body in a vertical layout auto hBoxLayout = new QVBoxLayout(this); hBoxLayout->addWidget(FHeaderWidget); hBoxLayout->addWidget(FBodyWidget); hBoxLayout->setContentsMargins(0,0,0,0); hBoxLayout->setSpacing(0); hBoxLayout->setAlignment(Qt::AlignTop); }
void QUmlForkNodeObject::setActivity(QObject *activity) { qmodelingelementproperty_cast<QUmlForkNode *>(this)->setActivity(qmodelingelementproperty_cast<QUmlActivity *>(activity)); emit activityChanged(this->activity()); }
void nsNativeAppSupportQt::RefreshStates() { activityChanged(mActivity.get()); displayStateChanged(mDisplayState.get()); deviceModeChanged(mDeviceMode.getMode()); }