void SmsDialog::sendSms() { kdebugf(); SmsSender *sender; if (m_configuration->deprecatedApi()->readBoolEntry("SMS", "BuiltInApp")) { int gatewayIndex = ProviderComboBox->currentIndex(); QString gatewayId = ProviderComboBox->itemData(gatewayIndex, Qt::UserRole).toString(); sender = m_pluginInjectedFactory->makeInjected<SmsInternalSender>(m_smsGatewayManager, m_smsScriptsManager, RecipientEdit->text(), m_smsGatewayManager->byId(gatewayId), this); } else { if (m_configuration->deprecatedApi()->readEntry("SMS", "SmsApp").isEmpty()) { MessageDialog::show(m_iconsManager->iconByPath(KaduIcon("dialog-warning")), tr("Kadu"), tr("SMS application was not specified. Visit the configuration section"), QMessageBox::Ok, this); kdebugm(KDEBUG_WARNING, "SMS application NOT specified. Exit.\n"); return; } sender = m_pluginInjectedFactory->makeInjected<SmsExternalSender>(RecipientEdit->text(), this); } connect(sender, SIGNAL(gatewayAssigned(QString, QString)), this, SLOT(gatewayAssigned(QString, QString))); sender->setSignature(SignatureEdit->text()); auto window = m_pluginInjectedFactory->makeInjected<ProgressWindow>(tr("Sending SMS...")); window->setCancellable(true); window->show(); connect(window, SIGNAL(canceled()), sender, SLOT(cancel())); connect(sender, SIGNAL(canceled()), window, SLOT(reject())); connect(sender, SIGNAL(progress(QString,QString)), window, SLOT(addProgressEntry(QString,QString))); connect(sender, SIGNAL(finished(bool,QString,QString)), window, SLOT(progressFinished(bool,QString,QString))); if (SaveInHistoryCheckBox->isChecked()) connect(sender, SIGNAL(smsSent(QString,QString)), this, SLOT(saveSmsInHistory(QString,QString))); sender->sendMessage(ContentEdit->toPlainText()); kdebugf2(); }
void ProgressWindow::progressFinished(bool ok, const QString &entryIcon, const QString &entryMessage) { Finished = true; CloseButton->setEnabled(true); CloseButton->setDefault(true); CloseButton->setFocus(); ProgressBar->setMaximum(10); if (ok) ProgressBar->setValue(10); else ProgressBar->setValue(0); if (!entryMessage.isEmpty()) addProgressEntry(entryIcon, entryMessage); qApp->alert(this); if (!ok && !entryMessage.isEmpty()) MessageDialog::show(KaduIcon(entryIcon), Label, entryMessage); }