Esempio n. 1
0
File: ctunit.cpp Progetto: KDE/kcron
QString CTUnit::exportUnit() const {
	if (!dirty) {
		return initialTokStr;
	}

	if (isAllEnabled())
		return QLatin1String( "*" );

	int total = enabledCount();
	int count = 0;
	QString tokenizeUnit;

	for (int num=min; num<=max; num++) {
		if (enabled[num]) {
			tokenizeUnit += QString::number(num);
			count++;

			if (count < total)
				tokenizeUnit += QLatin1Char( ',' );
		}
	}

	return tokenizeUnit;

}
Esempio n. 2
0
File: ctdow.cpp Progetto: loimu/zeit
QString CTDayOfWeek::describe() const {
	initializeNames();
	if (enabledCount() == CTDayOfWeek::MAXIMUM)
        return tr("every day ");
	else
		return CTUnit::genericDescribe(shortName);
}
Esempio n. 3
0
//////////////////////////////////////
//отправка сообщения в зависимости от установленных данных
void Data::send()
{
    //текст для вывода при отправке
    std::string logtext;
    //начальная установка отправителя / basic sender information and initialization
    senderInfo.senderName = senderName;
    senderInfo.server = server;
    senderInfo.senderMail = senderEmail;
    senderInfo.username = user;
    senderInfo.password = password;
    sender = new Sender(senderInfo);
    logtext += sender->get_log();
    sender->initialise_files(this->fileatach.size());
    for (int i=0; i<sender->nFiles; i++)
    {
        sender->fileNames[i] = fileatach[i];
    }
    sender->load_files();
    ////////////////////////////////
    //не отправляет сообщения, если нет текста. Если вы хотите это исправить уберите return
    if (message=="")
    {
        std::cerr << tr("No message!\n").toStdString();

        SendEvent* pe = new SendEvent();
        pe->setValue(SendEvent::SendData(
                tr("Nothing to send!\n").toStdString() ,100));
        QApplication::postEvent(window, pe);
        return;
    }
    int counter=0;
    //по очереди для всех адресатов / for all receivers
    for (int i=0; i<(int)recvEmail.size(); i++)
    {
        std::string logtextPart;
        if (stoped) return;
        //выполнять следующие действия только если включен адрес / send only if address enabled
        if (!recvData[i].enabled) continue;

        //получение настоящего сообщения из шаблона / get message from template
        std::string mes = get_mes(recvData[i]);
        //отправка
        sendEmail(recvEmail[i],recvData[i].name,theme,mes,logtextPart);

        logtext+=logtextPart;
        //отправка информации в окно send / send event to sendWindow
        int size = enabledCount();
        std::ostringstream omem;
        omem << "(" << counter++ << "/" << size << ")"
            << get_message_about_receiver(i);
        int percent = int(double(i)/double(size)*100);
        SendEvent* pe = new SendEvent();
        std::cout << logtextPart;
        pe->setValue(SendEvent::SendData(omem.str(),logtext,percent));
        QApplication::postEvent(window, pe);
    }
    std::ostringstream omem;
    //получение настоящего сообщения из шаблона / get message from template
    int size = enabledCount();
    //сообщение об окончании передачи / send 'end of transmission' event to sendWindow
    omem << "(" << size << "/" << size << tr(") -- end of transmission").toStdString();
    SendEvent* pe = new SendEvent();
    pe->setValue(SendEvent::SendData(omem.str(),logtext,101));
    QApplication::postEvent(window, pe);
}
Esempio n. 4
0
File: ctdom.cpp Progetto: KDE/kcron
QString CTDayOfMonth::describe() const {
	initializeNames();
	return (enabledCount() == CTDayOfMonth::MAXIMUM) ? i18n("every day ") : CTUnit::genericDescribe(shortName);
}