本文整理汇总了C++中Section::load方法的典型用法代码示例。如果您正苦于以下问题:C++ Section::load方法的具体用法?C++ Section::load怎么用?C++ Section::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _readSection
Section* _ELENA_::_readSection(StreamReader* reader)
{
Section* section = new Section();
size_t length = reader->getDWord();
section->load(reader, length);
section->_references.read(reader);
return section;
}
示例2: sendEmail
void Donations::sendEmail() {
QSettings settings;
Section sec;
PPSPerson pers;
QString subject, message, email;
QString attachment = tr("Donations_%1.qif").arg(QDate::currentDate().toString("yyyy-MM-dd"));
Smtp mail(settings.value("smtp/host", "localhost").toString(), settings.value("smtp/port", 587).toInt());
if (settings.value("smtp/authentication", "login").toString() == "login") {
mail.authLogin(settings.value("smtp/username", "").toString(), settings.value("smtp/password", "").toString());
} else {
mail.authPlain(settings.value("smtp/username", "").toString(), settings.value("smtp/password", "").toString());
}
// Send the Donations by EMail
createQif();
QList<QString>::const_iterator section;
QList<QString> keys = sectionQif.keys();
for (section = keys.constBegin(); section != keys.constEnd(); section++) {
// Create a tmp file form the QIF
char fname [L_tmpnam];
tmpnam(fname);
QString fileName(fname);
QFile f(fileName);
if (f.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&f);
out << sectionQif.value(*section);
out.flush();
f.close();
}
mail.clearAttachments();
mail.attach(fileName, attachment);
// Load the treasurer of the current Section
sec.load(*section);
pers.load(sec.treasurer());
// TODO: Load Subject and Texts
subject = QString("Donations for %1").arg(*section);
message = "Ahoi Treasurer,\n"
"This time still in a not verry beautifull Mailing.\n"
"In future you will also receive an additional PDF-Evidence with all information included. This time, the evidence from your Bank has to be be enough.\n\n"
"Attatched you'l find the contribution of the donations of the Pirate Party Switzerland for your section as a Quicken-Interchange File. This you can easily import with GnuCash in your accounting through 'File' -> 'Import' -> 'Import QIF...'.\n"
"You will receive the settlement during next days, change the valuta after in the imported booking.\n\n"
"Greetings,\nLukas Zurschmiede\nTreasurer Pirate Party Switzerland\n";
// Set the Mailtext and send the mail
mail.setTextMessage(message);
email = settings.value("smtp/from", "").toString();
if (pers.email().length() > 0) {
email = pers.email().at(0);
}
// If sending was not successfull (or no treasurer was found), let the user save the QIF
if (email.isEmpty() || !mail.send(settings.value("smtp/from", "[email protected]").toString(), email, subject)) {
QString fileName = QFileDialog::getSaveFileName(this, tr("Save donations for the section"), "", tr("Quicken Interchange Format (*.qif)"));
if (!fileName.isEmpty()) {
if (QFile::exists(fileName)) {
QFile::remove(fileName);
}
if (!QFile::copy(fname, fileName)) {
qDebug() << "Error while copying the QIF: " << fname << " to " << fileName;
}
}
}
// remove the tmp file
remove(fname);
}
}